i need to do something so the menu comes up and make it work property
i have no idea on my switch statement and how to delete student from list please help me
#include <stdio.h>
void main()
{
int ssn[1000];
int sex[1000];
char name[1000][30];
int Assignment_average[1000];
int Quiz_Average[1000];
int participation[1000];
int Midterm[1000];
int final[1000];
int i,j,menu;
int cnt=0;
int tot[1000];
double avr[1000];
int score[1000];
int best[1000];
printf("1.Print list of students\n3.Print list of those whom made an A grade\n4.Print list of those whom made an F grade\n5.Print list of students sorted by name\n6.add student to the class list\n7.delete student from class list\n8. quit",&menu )
scanf("%d",&menu);
switch(menu)
{
case 1:
case 2:
case 3:
case 4:
}
if(ssm[i]==-999) break; //add students
printf("Input a Name! =");
scanf("%s",&name[i]);
printf("Input a Assignment_average=");
scanf("%d",&Assignment_average[i]);
printf("Input a Quiz_Average=");
scanf("%d",&Quiz_Average[i]);
printf("Input a participation=");
scanf("%d",&participation[i]);
printf("Input a Midterm=");
scanf("%d",&Midterm[i]);
printf("Input a final=");
scanf("%d",&final[i]);
cnt++;
}
for(i=0;i {
tot[i]=0.40*Assignment_average[i]+ Quiz_Average[i]*0.15+ participation[i]*0.10+Midterm[i]*0.15+ final[i]*0.20 avr[i]=tot[i]*100;
}
I would clean up the printf a bit by making it more readable. Also I am not sure why you are passing the argument "&menu" to your printf. Its incorrect in this context.
Something like this would be much easier to read.
printf("1.Print list of students\n");
printf("3.Print list of those whom made an A grade\n");
printf("4.Print list of those whom made an F grade\n");
printf("5.Print list of students sorted by name\n");
printf("6.add student to the class list\n");
printf("7.delete student from class list\n");
printf("8. quit\n");
And after you've read the menu, you need to perform the processing for the menu item selected in your switch case.
switch (menuitem){
case 1:
// print list
break;
case 2:
// print list of A students
break;
...
....
default:
break;
}