Wednesday, 23 April 2014

Write an interactive Cprogram which prompts the user with the following options on the opening menu: (40 Marks) 1) Study Centre Information 2) Details of the programmes activated in the study centre 3) Scheduling of theory/practical sessions for BCA programee 4) Academic Councillor Details 5) Assignments submission and viva voce schedule 7) Quit Enter your choice: If an “1” is entered, prompt the user to enter the study centre code and know the details about the study like name of the study centre, name of the regional centre, name of the study centre coordinator, programme in-charge details etc. If “2” is entered, it should give the details of all the programmes those are activated in the centre. If “3” is entered, it should give the schedule for the theory and practical counselling sessions for BCA programme for the current session. If “4” is entered it should display the details of the academic councillors’ associated with respective programmes. If “5” is entered it should display the assignments submission and viva voce schedule for the current session. 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 practical question. Assumptions can be made wherever necessary.

#include<conio.h>
#include<stdio.h>
struct bcastudent
{
int stcode;
char scname[50];
char scaddr[300];
char rcname[50];
char sccoor[250];
char icname[250];
char progac[7];
char thdate[25];
char thtime[25];
char prdate[25];
char prtime[25];
char accoun[250];
char assubm[250];
char vivavo[250];
}s;
FILE *f1,*f2;
int i,amount,rol;
char chh[150];
int ch;
int b,p;
addrecord()
{
f1=fopen("data1","ab");
fflush(stdin);
printf("\nEnter the Study Center Code                = ");
scanf("%d",&s.stcode);
fflush(stdin);
printf("\nEnter the Name of the Study Center            = ");
scanf("%s",s.scname);
fflush(stdin);
printf("\nEnter the Address of the Study Center            = ");
scanf("%s",s.scaddr);
fflush(stdin);
printf("\nEnter the Name of the Regional Center            = ");
scanf("%s",&s.rcname);
fflush(stdin);
printf("\nEnter the Name of the Study Center Coordinator        = ");
scanf("%s",&s.sccoor);
fflush(stdin);
printf("\nEnter the Name of the Program In-Charge            = ");
scanf("%s",&s.icname);
fflush(stdin);
printf("\nEnter the Details of Programs Activated in the Center    = ");
scanf("%s",s.progac);
fflush(stdin);
printf("\nEnter the Date for Theory Counseling");
printf("\nSession for BCA Program (DD/MM/YYYY)            = ");
scanf("%s",s.thdate);
fflush(stdin);
printf("\nEnter the Time for Theory Counseling");
printf("\nSession for BCA Program (00:00 AM/PM)            = ");
scanf("%s",s.thtime);
fflush(stdin);
printf("\nEnter the Date for Practical Counseling");
printf("\nSession for BCA Program (DD/MM/YYYY)            = ");
scanf("%s",s.prdate);
fflush(stdin);
printf("\nEnter the Time for Practical Counseling");
printf("\nSession for BCA Program (00:00 AM/PM)            = ");
scanf("%s",s.prtime);
fflush(stdin);
printf("\nEnter the Details of the Academic Counselors");
printf("\nAssociated with Respective Programs (PROG COUNSELOR)    = ");
scanf("%s",s.accoun);
fflush(stdin);
printf("\nEnter the Assignments Submission Schedule");
printf("\nfor the Current Session (PROGNAME    LASTDATE    = ");
scanf("%s",s.assubm);
fflush(stdin);
printf("\nEnter the Viva Voce Schedule");
printf("\nfor the Current Session (PROGNAME    DATE        = ");
scanf("%s",s.vivavo);
fwrite(&s,sizeof(s),1,f1);
fflush(stdin);
fclose(f1);
return 0;
}
disprecord()
{
f1=fopen("data1","r+b");
fflush(f1);
rewind(f1);
while(fread(&s,sizeof(s),1,f1))
{
printf("\nStudy Center Code=%d\n",s.stcode);
printf("\nName of the Study Center=%s\n",s.scname);
printf("\nAddress of the Study Center=%s\n",s.scaddr);
printf("\nName of the Regional Center=%s\n",s.rcname);
printf("\nName of the Study Center Coordinator=%s\n",s.sccoor);
printf("\nName of the Program In-Charge=%s\n",s.icname);
}
close(f1);
return 0;
}
disprec()
{
f1=fopen("data1","rb+");
fflush(stdin);
printf("Enter the Study Center Code=");
scanf("%d",&rol);
{
if(rol==s.stcode)
{
printf("\n*********************************************************\n");
printf("\nStudy Center Code            =  %d\n",s.stcode);
printf("\nName of the Study Center        =  %s\n",s.scname);
printf("\nAddress of the Study Center        =  %s\n",s.scaddr);
printf("\nName of the Regional Center        =  %s\n",s.rcname);
printf("\nName of the Study Center Coordinator    =  %s\n",s.sccoor);
printf("\nName of the Program In-Charge        =  %s\n",s.icname);
printf("\n*********************************************************\n");
}
}
close(f1);
return 0;
}
dispactiv()
{
f1=fopen("data1","rb+");
fflush(stdin);
printf("Enter the Study Center Code=");
scanf("%d",&b);
{
if(b==s.stcode)
{
printf("\nDetails of the Programs Activated in Study Center = CMR");
printf("\n                                                  = %s\n",s.progac); 
}
}
close(f1);
return 0;
}
dispsched()
{
f1=fopen("data1","rb+");
fflush(stdin);
printf("Enter the Study Center Code=");
scanf("%d",&p);
{
if(p==s.stcode)
{
printf("\nDate for Theory Counseling Session for BCA Program    =  %s\n",s.thdate);
printf("\nTime for Theory Counseling Session for BCA Program    =  %s\n",s.thtime);
printf("\nDate for Practical Counseling Session for BCA Program    =  %s\n",s.prdate);
printf("\nTime for Practical Counseling Session for BCA Program    =  %s\n",s.prtime);
}
}
close(f1);
return 0;
}
dispacco()
{
f1=fopen("data1","rb+");
fflush(stdin);
printf("Enter the Study Center Code=");
scanf("%d",&p);
{
if(p==s.stcode)
{
printf("\nDetails of the Academic Counselors Associated with Respective Programs\n");
printf("\n               PROGRAM NAME              COUNSELOR NAME               \n");
printf("\n                   BCA                        MISHRA                  \n");
}
}
close(f1);
return 0;
}
dispsubm()
{
f1=fopen("data1","rb+");
fflush(stdin);
printf("Enter the Study Center Code=");
scanf("%d",&p);
{
if(p==s.stcode)
{
printf("\n*******************************************************\n");
printf("\nAssignments Submission Schedule for the Current Session\n");
printf("\n*******************************************************\n");
printf("\n                                                       \n");
printf("\n           PROGRAM NAMES          LAST DATES           \n");
printf("\n                BCA               15/04/2013           \n");
printf("\n                                                       \n");
printf("\n                                                       \n");
printf("\n      Viva Voce Schedule for the Current Session       \n");
printf("\n*******************************************************\n");
printf("\n                                                       \n");
printf("\n               PROGRAM NAME        DATE                \n");
printf("\n                    BCA          15/06/2013            \n");
printf("\n*******************************************************\n");
}
}
close(f1);
return 0;
}
main()
{
char chh='y';
i=sizeof(s);
do
{
clrscr();
printf("\n\t ********Classes for BCA & MCA from IGNOU*******\n");

printf("\n***************************************************************************\n");
printf("\n\n To Add Study Center Details                    PRESS 0");
printf("\n\n To Display Study Centre Information                PRESS 1");
printf("\n\n For Details of the programmes Activated in the Study Center    PRESS 2");
printf("\n\n For Scheduling of Theory/Practical Sessions for BCA programmes    PRESS 3");
printf("\n\n For Academic Councillor Details                PRESS 4");
printf("\n\n For Assignments Submission and Viva Voce Schedule        PRESS 5");
printf("\n\n To Quit                            PRESS 6");
printf("\n\n*************************************************************************\n");
printf("\n\n Enter your choice                    :");
scanf("%d",&ch);
switch(ch)
{
case 0:
addrecord();
break;
case 1:
disprec();
break;
case 2:
dispactiv();
break;
case 3:
dispsched();
break;
case 4:
dispacco();
break;
case 5:
dispsubm();
break;
case 6:
exit(0);
break;
default:
printf("\wrong choice");
}
printf("\n\nDo you want to continue(Y/N)");
chh=getche();
}while(chh=='Y');
getch();
return 0;
}


No comments:

Post a Comment