Programme Code : MCA
Course Code : MCS-011
| More

Year : 2012 Views: 1991 Submitted By : giriraj On 16th September, 2012

Do you have solution for this Question. If yes    I aslo want solution.

Q.


Write an interactive program to generate progress reports

for the students of class XII (Science group).

Assumptions can be made wherever necessary.


Catch The Solution

By PULAK PAUL


Write an interactive program to generate progress reports for the students of class XII (Science group)



Answer: Interactive C program to generate progress reports of the students is as follows:

#include

#include



#define STU_NUM 3

#define NAME_LEN 100

#define SUB_NUM 3



struct student

{

int id;

char name[NAME_LEN];

char group;

int subject_marks[SUB_NUM];

int total;

int percentage;

};



void main()

{

int i, j, k, l, total, percentage;

struct student stud[STU_NUM];

clrscr();



//Get the required data from user.

for(i=0; i
{

j = i+1;



printf("\n\nEnter the ID of student %d: ",j);

scanf("%d",&stud[i].id);

fflush(stdin);



printf("\nEnter the name of student %d: ",j);

gets(stud[i].name);

fflush(stdin);



printf("\nEnter the group selected by student %d (A/B): ",j);

scanf("%c",&stud[i].group);

fflush(stdin);



for(k=0; k
{

l = k+1;

printf("\nEnter the marks of subject %d for student %d: ",l,j);

scanf("%d",&stud[i].subject_marks[k]);

}

fflush(stdin);

}



//Calculate total & percentage of the student.

for(i=0; i
{

total = 0;

percentage = 0;

for(k=0; k
{

total = total + stud[i].subject_marks[k];

}

percentage = total / SUB_NUM;



stud[i].total = total;

stud[i].percentage = percentage;

}



//Display the progress report of the students.

clrscr();

for(i=0; i
{

printf("ID: %d \t Name: %s \t Group: %c \n", stud[i].id, stud[i].name, stud[i].group);



for(k=0; k
{

l = k+1;

printf("Subject %d: %d / 100 \n", l, stud[i].subject_marks[k]);

}

printf("Total: %d \t Percentage: %d \n", stud[i].total, stud[i].percentage);

printf("\n----------------------------------------------------------------------\n\n");

}



getch();

}




Q Declare two arrays A and B, find (i) A intersection B and (ii) A union B.

sushant sadashiv belekar    12th October, 2012 Hits: 1542