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

PPTX
C programming language tutorial
Dr. SURBHI SAROHA
 
PPT
Macros in system programing
Brijesh__patel
 
PPTX
Functions in c language
Tanmay Modi
 
DOCX
Inline function(oops)
Jay Patel
 
PDF
10. funtions and closures IN SWIFT PROGRAMMING
LOVELY PROFESSIONAL UNIVERSITY
 
PDF
Algoritma dan Struktur Data - antrian
Georgius Rinaldo
 
PDF
User_Defined_Functions_ppt_slideshare.
NabeelaNousheen
 
PPTX
Map, Filter and Reduce In Python
Simplilearn
 
C programming language tutorial
Dr. SURBHI SAROHA
 
Macros in system programing
Brijesh__patel
 
Functions in c language
Tanmay Modi
 
Inline function(oops)
Jay Patel
 
10. funtions and closures IN SWIFT PROGRAMMING
LOVELY PROFESSIONAL UNIVERSITY
 
Algoritma dan Struktur Data - antrian
Georgius Rinaldo
 
User_Defined_Functions_ppt_slideshare.
NabeelaNousheen
 
Map, Filter and Reduce In Python
Simplilearn
 

What's hot (20)

PDF
88 c-programs
Leandro Schenone
 
PPTX
Solving Large Scale Optimization Problems using CPLEX Optimization Studio
optimizatiodirectdirect
 
PPTX
Function C programming
Appili Vamsi Krishna
 
PPT
Introduction to Basic C programming 01
Wingston
 
PDF
Object Oriented Programming(OOP) CS304 handouts
Sohaib Danish
 
PPTX
Python
Aashish Jain
 
PDF
Les enregistrements
mohamed_SAYARI
 
PDF
Python Functions (PyAtl Beginners Night)
Rick Copeland
 
PDF
Access specifiers (Public Private Protected) C++
vivekkumar2938
 
PPTX
Functions in Python
Kamal Acharya
 
PPTX
Full Python in 20 slides
rfojdar
 
PPT
Void pointer in c
SANDIP MORADIYA
 
PDF
Essential Software Architecture - Chapter 1 Understanding Software Architectu...
John Ortiz
 
PPTX
Tree structured partitioning into transform blocks and units and interpicture...
LainAcarolu
 
PPTX
functions in C and types
mubashir farooq
 
PDF
Clean code: understanding Boundaries and Unit Tests
radin reth
 
PDF
Left factor put
siet_pradeep18
 
PDF
Micro-controllers (PIC) based Application Development
Emertxe Information Technologies Pvt Ltd
 
PDF
Python syntax
Learnbay Datascience
 
88 c-programs
Leandro Schenone
 
Solving Large Scale Optimization Problems using CPLEX Optimization Studio
optimizatiodirectdirect
 
Function C programming
Appili Vamsi Krishna
 
Introduction to Basic C programming 01
Wingston
 
Object Oriented Programming(OOP) CS304 handouts
Sohaib Danish
 
Python
Aashish Jain
 
Les enregistrements
mohamed_SAYARI
 
Python Functions (PyAtl Beginners Night)
Rick Copeland
 
Access specifiers (Public Private Protected) C++
vivekkumar2938
 
Functions in Python
Kamal Acharya
 
Full Python in 20 slides
rfojdar
 
Void pointer in c
SANDIP MORADIYA
 
Essential Software Architecture - Chapter 1 Understanding Software Architectu...
John Ortiz
 
Tree structured partitioning into transform blocks and units and interpicture...
LainAcarolu
 
functions in C and types
mubashir farooq
 
Clean code: understanding Boundaries and Unit Tests
radin reth
 
Left factor put
siet_pradeep18
 
Micro-controllers (PIC) based Application Development
Emertxe Information Technologies Pvt Ltd
 
Python syntax
Learnbay Datascience
 
Ad

Similar to 2012 bcsl-021 solve assihnment (20)

PDF
GE23121_C programming Laboratory Record.pdf
deepak14367
 
PPTX
3rd semester 4gsbshagscv.akshathamahsbpptx
yathinmanimajalu123
 
PPT
slidenotesece246jun2012-140803084954-phpapp01 (1).ppt
yatakonakiran2
 
DOCX
Cs8251 faq1
tamilvanan76
 
PDF
Chapter 5 exercises Balagurusamy Programming ANSI in c
BUBT
 
PDF
Lab program 1234567891234567891234567891
akashpunarvi2005
 
PDF
Complete Lab 123456789123456789123456789
vickyvikas51556
 
PDF
lab.123456789123456789123456789123456789
Ghh
 
PPT
c-programming
Zulhazmi Harith
 
DOCX
Best C Programming Solution
yogini sharma
 
PDF
Zoro123456789123456789123456789123456789
Ghh
 
PDF
labb123456789123456789123456789123456789
Ghh
 
PPSX
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
DOC
Student record
Upendra Sengar
 
PDF
C lab programs
Dr. Prashant Vats
 
PDF
C lab programs
Dr. Prashant Vats
 
PDF
POP Unit 2.pptx.pdf for your time and gauss with example
siddarameshav871
 
DOCX
C file
simarsimmygrewal
 
DOCX
A c program of Phonebook application
svrohith 9
 
PPTX
Introduction to Basic C programming 02
Wingston
 
GE23121_C programming Laboratory Record.pdf
deepak14367
 
3rd semester 4gsbshagscv.akshathamahsbpptx
yathinmanimajalu123
 
slidenotesece246jun2012-140803084954-phpapp01 (1).ppt
yatakonakiran2
 
Cs8251 faq1
tamilvanan76
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
BUBT
 
Lab program 1234567891234567891234567891
akashpunarvi2005
 
Complete Lab 123456789123456789123456789
vickyvikas51556
 
lab.123456789123456789123456789123456789
Ghh
 
c-programming
Zulhazmi Harith
 
Best C Programming Solution
yogini sharma
 
Zoro123456789123456789123456789123456789
Ghh
 
labb123456789123456789123456789123456789
Ghh
 
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
Student record
Upendra Sengar
 
C lab programs
Dr. Prashant Vats
 
C lab programs
Dr. Prashant Vats
 
POP Unit 2.pptx.pdf for your time and gauss with example
siddarameshav871
 
A c program of Phonebook application
svrohith 9
 
Introduction to Basic C programming 02
Wingston
 
Ad

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

PDF
Mcs 17 solved assignment 2015- 16
Indira Gnadhi National Open University (IGNOU)
 
PDF
Mcs 16 solved assignment 2015-16
Indira Gnadhi National Open University (IGNOU)
 
PDF
Mcs 014 solved assignment 2015-16
Indira Gnadhi National Open University (IGNOU)
 
PDF
Mcs 012 soved assignment 2015-16
Indira Gnadhi National Open University (IGNOU)
 
PDF
Mcs 011 solved assignment 2015-16
Indira Gnadhi National Open University (IGNOU)
 
PDF
BCSL 058 solved assignment
Indira Gnadhi National Open University (IGNOU)
 
PDF
BCSL 057 solved assignments
Indira Gnadhi National Open University (IGNOU)
 
PDF
BCSL 056 solved assignment
Indira Gnadhi National Open University (IGNOU)
 
PDF
Bcs 053 solved assignment 2014-15
Indira Gnadhi National Open University (IGNOU)
 
PDF
Bcsl 022 solved-assignment_2012-13
Indira Gnadhi National Open University (IGNOU)
 

Recently uploaded (20)

PPTX
CDH. pptx
AneetaSharma15
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPTX
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PPTX
Trends in pediatric nursing .pptx
AneetaSharma15
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PDF
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
CDH. pptx
AneetaSharma15
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
Trends in pediatric nursing .pptx
AneetaSharma15
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 

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