SlideShare a Scribd company logo
Course Code
Course Title

:
:

BCSL-021
C Language Programming

1) Write an interactive C program which prompts the user with the following options
on the opening menu:
(40 Marks)
1) Student information
2) Theory counselling batch-scheduling
3) Practical counselling batch-scheduling
4) Assignment submissions
5) Change of the correspondence address
6) General Queries
7) Quit
Enter your choice:

If an “1” is entered, prompt the student for the enrolment number and display the student
information containing the details the semester he registered for, year of study, name of
the programme, batch, duration details, name of the study centre, name of the regional
centre, details regarding the fees s/he paid etc . If “2” is entered, it should give the
schedule for the theory counselling upon giving the batch number as input. . If “3” is
entered, it should give the schedule for the practical counselling upon giving the batch
number as input. If “4” is entered it should display the a ssignment submission schedules
and viva voce schedules. If “5” is entered it should display the present correspondence
address and should prompt the user to enter the change in the same if any and the
necessary file is to be updated with the revised address. If “6” is entered it should present
the general frequently asked questions. If “7” is entered, exit the program. If the user
enters any letters or numbers other than the choice, redisplay the prompt. All output
should go to the terminal and all input should come from the keyboard.
Note: You must execute the program and submit the program logic, sample input and
output along with the necessary documentation for this question. Assumptions can be
made wherever necessary.
Ans:
//you can add some more fields...............
//You must add some Records before run………………….
//copy this code in Notepad and save with extension ".c" in "tc bin" folder and run it.
#include<conio.h>
#include<stdio.h>
struct bcastudent
{
int enrol;

www.pixelesindia.com
char name[10];
int sem;
int batch;
char th[50];
char pr[50];
char stcode[10];
char add[150];
}s;
FILE *f1,*f2;
int i,amount,rol;
char chh[150];
int ch;
int b,p;

void addrecord()
{
f1=fopen("data1","ab");
printf("nenter the Enrolment No=");
scanf("%d",&s.enrol);
printf("nenter the Programme name=");
scanf("%s",s.name);
printf("nenter the semester=");
scanf("%d",&s.sem);
printf("nenter the batch(integer)=");
scanf("%d",&s.batch);
printf("nenter the Theory Conselling=");
scanf("%s",s.th);
printf("nenter the Practical Conselling=");
scanf("%s",s.pr);
printf("nenter the study center code=");
scanf("%s",s.stcode);
printf("nenter the Address");
scanf("%s",s.add);
fwrite(&s,sizeof(s),1,f1);
fflush(stdin);
fclose(f1);
}
void disprecord()
{
f1=fopen("data1","r+b");
fflush(f1);

www.pixelesindia.com
rewind(f1);
while(fread(&s,sizeof(s),1,f1))
{
printf("nEnrollment=%dn",s.enrol);
printf("Programme Name=%sn",s.name);
printf("Semester=%dn",s.sem);
printf("Study Center=%sn",s.stcode);
printf("Address=%sn",s.add);
printf("Batch=%dn",s.batch);
}
close(f1);
}
void searchrec()
{
f1=fopen("data1","rb+");
printf("enter the Enrolment NO.");
scanf("%d",&rol);
rewind(f1);
while(fread(&s,sizeof(s),1,f1))
{
if(rol==s.enrol)
{
printf("nEnrollment=%dn",s.enrol);
printf("Programm name=%sn",s.name);
printf("Semester=%dn",s.sem);
printf("Study Center=%sn",s.stcode);
printf("Address=%sn",s.add);
printf("Batch=%dn",s.batch);
}
}
close(f1);
}
void searchtheory()
{
f1=fopen("data1","rb+");
printf("enter the Batch NO.");
scanf("%d",&b);
rewind(f1);
while(fread(&s,sizeof(s),1,f1))
{
if(b==s.batch)
{
printf("Theory counselling=%sn",s.th);

www.pixelesindia.com
printf("Batch=%dn",s.batch);
}
}
close(f1);
}
void searchpr()
{
f1=fopen("data1","rb+");
printf("enter the Batch NO.");
scanf("%d",&p);
rewind(f1);
while(fread(&s,sizeof(s),1,f1))
{
if(p==s.batch)
{
printf("Theory counselling=%sn",s.pr);
printf("Batch=%dn",s.batch);
}
}
close(f1);
}

void chadd()
{
f1=fopen("data1","rb+");
clrscr();
printf("enter the Enroll. NO.");
scanf("%d",&rol);
printf("enter the New Address");
scanf("%s",chh);
rewind(f1);
while(fread(&s,sizeof(s),1,f1))
{
if(rol==s.enrol)
{
strcpy(s.add,chh);
printf("Your new address is=%sn",s.add);
fseek(f1,- i,SEEK_CUR);
fwrite(&s,sizeof(s),1,f1);
fflush(f1);
}
}

www.pixelesindia.com
close(f1);
}

main()
{
char chh='y';
i=sizeof(s);
do
{
clrscr();
printf("nt **PIXELES Classes for BCA & MCA from IGNOU** n");
printf("programming Classes Anil Kumar "Suman",Author");
printf("n*********************************************************** n");
printf("nn
0-Add Student Details:");
printf("nn
1-Display student information:");
printf("nn
2-Theory Counselling:");
printf("nn
3-Practical Counselling:");
printf("nn
4-Assignment Submission:");
printf("nn
5-Change Address:");
printf("nn
6-General Quesries:");
printf("nn
7-Quit:");
printf("nn***********************************************************n");
printf("nn
Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 0:
addrecord();
break;
case 1:
searchrec();
break;
case 2:
searchtheory();
break;
case 3:
searchpr();
break;
case 4:
printf("n****Assignment Submission Date*****n");
printf("nBatch1===> 22 March");

www.pixelesindia.com
printf("nBatch2===> 23 March");
printf("nBatch3===> 24 March");
printf("nBatch4===> 25 March");
break;
case 5:
chadd();
break;
case 6:
disprecord();
break;
case 7:
exit(0);
break;
default:
printf("wrong choice");
}
printf("nnDo you want to continue(y/n)");
chh=getche();
}while(chh=='y');
getch();
}

www.pixelesindia.com

More Related Content

PDF
Báo cáo đồ án đề tài xây dựng trợ lý ảo bằng python
PDF
Hoạch định các nguồn lực trong doanh nghiệp
PDF
GE23121_C programming Laboratory Record.pdf
PPTX
3rd semester 4gsbshagscv.akshathamahsbpptx
PPT
slidenotesece246jun2012-140803084954-phpapp01 (1).ppt
DOCX
Cs8251 faq1
Báo cáo đồ án đề tài xây dựng trợ lý ảo bằng python
Hoạch định các nguồn lực trong doanh nghiệp
GE23121_C programming Laboratory Record.pdf
3rd semester 4gsbshagscv.akshathamahsbpptx
slidenotesece246jun2012-140803084954-phpapp01 (1).ppt
Cs8251 faq1

Similar to 2012 bcsl-021 solve assihnment (20)

PDF
Chapter 5 exercises Balagurusamy Programming ANSI in c
PDF
Lab program 1234567891234567891234567891
PDF
Complete Lab 123456789123456789123456789
PDF
lab.123456789123456789123456789123456789
 
PPT
c-programming
DOCX
Best C Programming Solution
PDF
Zoro123456789123456789123456789123456789
 
PDF
labb123456789123456789123456789123456789
 
PPSX
Esoft Metro Campus - Certificate in c / c++ programming
DOC
Student record
PDF
C lab programs
PDF
C lab programs
PDF
POP Unit 2.pptx.pdf for your time and gauss with example
DOCX
DOCX
A c program of Phonebook application
PPTX
Introduction to Basic C programming 02
DOC
Course Breakup - C Porgramming Language
DOC
Course Break - C Language
DOC
Student copybca sem1-c
PPTX
UNIT 1.pptx Programming for Problem Solving
Chapter 5 exercises Balagurusamy Programming ANSI in c
Lab program 1234567891234567891234567891
Complete Lab 123456789123456789123456789
lab.123456789123456789123456789123456789
 
c-programming
Best C Programming Solution
Zoro123456789123456789123456789123456789
 
labb123456789123456789123456789123456789
 
Esoft Metro Campus - Certificate in c / c++ programming
Student record
C lab programs
C lab programs
POP Unit 2.pptx.pdf for your time and gauss with example
A c program of Phonebook application
Introduction to Basic C programming 02
Course Breakup - C Porgramming Language
Course Break - C Language
Student copybca sem1-c
UNIT 1.pptx Programming for Problem Solving
Ad

More from Indira Gnadhi National Open University (IGNOU) (17)

PDF
Mcs 17 solved assignment 2015- 16
PDF
Mcs 16 solved assignment 2015-16
PDF
Mcs 014 solved assignment 2015-16
PDF
Mcs 012 soved assignment 2015-16
PDF
Mcs 011 solved assignment 2015-16
PDF
PDF
PDF
PDF
Bcs 053 solved assignment 2014-15
PDF
Bcsl 022 solved-assignment_2012-13
Ad

Recently uploaded (20)

PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
RMMM.pdf make it easy to upload and study
PDF
Insiders guide to clinical Medicine.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Basic Mud Logging Guide for educational purpose
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Classroom Observation Tools for Teachers
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cell Types and Its function , kingdom of life
PDF
01-Introduction-to-Information-Management.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
RMMM.pdf make it easy to upload and study
Insiders guide to clinical Medicine.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Basic Mud Logging Guide for educational purpose
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Complications of Minimal Access Surgery at WLH
Renaissance Architecture: A Journey from Faith to Humanism
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Classroom Observation Tools for Teachers
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cell Types and Its function , kingdom of life
01-Introduction-to-Information-Management.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPH.pptx obstetrics and gynecology in nursing

2012 bcsl-021 solve assihnment

  • 1. Course Code Course Title : : BCSL-021 C Language Programming 1) Write an interactive C program which prompts the user with the following options on the opening menu: (40 Marks) 1) Student information 2) Theory counselling batch-scheduling 3) Practical counselling batch-scheduling 4) Assignment submissions 5) Change of the correspondence address 6) General Queries 7) Quit Enter your choice: If an “1” is entered, prompt the student for the enrolment number and display the student information containing the details the semester he registered for, year of study, name of the programme, batch, duration details, name of the study centre, name of the regional centre, details regarding the fees s/he paid etc . If “2” is entered, it should give the schedule for the theory counselling upon giving the batch number as input. . If “3” is entered, it should give the schedule for the practical counselling upon giving the batch number as input. If “4” is entered it should display the a ssignment submission schedules and viva voce schedules. If “5” is entered it should display the present correspondence address and should prompt the user to enter the change in the same if any and the necessary file is to be updated with the revised address. If “6” is entered it should present the general frequently asked questions. If “7” is entered, exit the program. If the user enters any letters or numbers other than the choice, redisplay the prompt. All output should go to the terminal and all input should come from the keyboard. Note: You must execute the program and submit the program logic, sample input and output along with the necessary documentation for this question. Assumptions can be made wherever necessary. Ans: //you can add some more fields............... //You must add some Records before run…………………. //copy this code in Notepad and save with extension ".c" in "tc bin" folder and run it. #include<conio.h> #include<stdio.h> struct bcastudent { int enrol; www.pixelesindia.com
  • 2. char name[10]; int sem; int batch; char th[50]; char pr[50]; char stcode[10]; char add[150]; }s; FILE *f1,*f2; int i,amount,rol; char chh[150]; int ch; int b,p; void addrecord() { f1=fopen("data1","ab"); printf("nenter the Enrolment No="); scanf("%d",&s.enrol); printf("nenter the Programme name="); scanf("%s",s.name); printf("nenter the semester="); scanf("%d",&s.sem); printf("nenter the batch(integer)="); scanf("%d",&s.batch); printf("nenter the Theory Conselling="); scanf("%s",s.th); printf("nenter the Practical Conselling="); scanf("%s",s.pr); printf("nenter the study center code="); scanf("%s",s.stcode); printf("nenter the Address"); scanf("%s",s.add); fwrite(&s,sizeof(s),1,f1); fflush(stdin); fclose(f1); } void disprecord() { f1=fopen("data1","r+b"); fflush(f1); www.pixelesindia.com
  • 3. rewind(f1); while(fread(&s,sizeof(s),1,f1)) { printf("nEnrollment=%dn",s.enrol); printf("Programme Name=%sn",s.name); printf("Semester=%dn",s.sem); printf("Study Center=%sn",s.stcode); printf("Address=%sn",s.add); printf("Batch=%dn",s.batch); } close(f1); } void searchrec() { f1=fopen("data1","rb+"); printf("enter the Enrolment NO."); scanf("%d",&rol); rewind(f1); while(fread(&s,sizeof(s),1,f1)) { if(rol==s.enrol) { printf("nEnrollment=%dn",s.enrol); printf("Programm name=%sn",s.name); printf("Semester=%dn",s.sem); printf("Study Center=%sn",s.stcode); printf("Address=%sn",s.add); printf("Batch=%dn",s.batch); } } close(f1); } void searchtheory() { f1=fopen("data1","rb+"); printf("enter the Batch NO."); scanf("%d",&b); rewind(f1); while(fread(&s,sizeof(s),1,f1)) { if(b==s.batch) { printf("Theory counselling=%sn",s.th); www.pixelesindia.com
  • 4. printf("Batch=%dn",s.batch); } } close(f1); } void searchpr() { f1=fopen("data1","rb+"); printf("enter the Batch NO."); scanf("%d",&p); rewind(f1); while(fread(&s,sizeof(s),1,f1)) { if(p==s.batch) { printf("Theory counselling=%sn",s.pr); printf("Batch=%dn",s.batch); } } close(f1); } void chadd() { f1=fopen("data1","rb+"); clrscr(); printf("enter the Enroll. NO."); scanf("%d",&rol); printf("enter the New Address"); scanf("%s",chh); rewind(f1); while(fread(&s,sizeof(s),1,f1)) { if(rol==s.enrol) { strcpy(s.add,chh); printf("Your new address is=%sn",s.add); fseek(f1,- i,SEEK_CUR); fwrite(&s,sizeof(s),1,f1); fflush(f1); } } www.pixelesindia.com
  • 5. close(f1); } main() { char chh='y'; i=sizeof(s); do { clrscr(); printf("nt **PIXELES Classes for BCA & MCA from IGNOU** n"); printf("programming Classes Anil Kumar "Suman",Author"); printf("n*********************************************************** n"); printf("nn 0-Add Student Details:"); printf("nn 1-Display student information:"); printf("nn 2-Theory Counselling:"); printf("nn 3-Practical Counselling:"); printf("nn 4-Assignment Submission:"); printf("nn 5-Change Address:"); printf("nn 6-General Quesries:"); printf("nn 7-Quit:"); printf("nn***********************************************************n"); printf("nn Enter your choice:"); scanf("%d",&ch); switch(ch) { case 0: addrecord(); break; case 1: searchrec(); break; case 2: searchtheory(); break; case 3: searchpr(); break; case 4: printf("n****Assignment Submission Date*****n"); printf("nBatch1===> 22 March"); www.pixelesindia.com
  • 6. printf("nBatch2===> 23 March"); printf("nBatch3===> 24 March"); printf("nBatch4===> 25 March"); break; case 5: chadd(); break; case 6: disprecord(); break; case 7: exit(0); break; default: printf("wrong choice"); } printf("nnDo you want to continue(y/n)"); chh=getche(); }while(chh=='y'); getch(); } www.pixelesindia.com