943,892 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 510
  • C RSS
May 31st, 2009
0

help plz with grading program

Expand Post »
hi
i need help with my grading program

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

  1. #include <stdio.h>
  2.  
  3.  
  4. void main()
  5. {
  6.  
  7. int ssn[1000];
  8. int sex[1000];
  9. char name[1000][30];
  10. int Assignment_average[1000];
  11. int Quiz_Average[1000];
  12. int participation[1000];
  13. int Midterm[1000];
  14. int final[1000];
  15. int i,j,menu;
  16. int cnt=0;
  17. int tot[1000];
  18.  
  19. double avr[1000];
  20. int score[1000];
  21. int best[1000];
  22.  
  23. 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 )
  24. scanf("%d",&menu);
  25.  
  26. switch(menu)
  27. {
  28. case 1:
  29. case 2:
  30. case 3:
  31. case 4:
  32. }
  33.  
  34.  
  35. if(ssm[i]==-999) break; //add students
  36. printf("Input a Name! =");
  37. scanf("%s",&name[i]);
  38. printf("Input a Assignment_average=");
  39. scanf("%d",&Assignment_average[i]);
  40. printf("Input a Quiz_Average=");
  41. scanf("%d",&Quiz_Average[i]);
  42. printf("Input a participation=");
  43. scanf("%d",&participation[i]);
  44. printf("Input a Midterm=");
  45. scanf("%d",&Midterm[i]);
  46. printf("Input a final=");
  47. scanf("%d",&final[i]);
  48. cnt++;
  49. }
  50.  
  51.  
  52.  
  53. for(i=0;i {
  54. 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;
  55. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wislean is offline Offline
1 posts
since May 2009
May 31st, 2009
0

Re: help plz with grading program

Ooh, yet another grade supersystem...

Better try to search DaniWeb for grade. There are lots of dozens of grade calculation threads (solved)...
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Jun 3rd, 2009
0

Re: help plz with grading program

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.

  1. printf("1.Print list of students\n");
  2. printf("3.Print list of those whom made an A grade\n");
  3. printf("4.Print list of those whom made an F grade\n");
  4. printf("5.Print list of students sorted by name\n");
  5. printf("6.add student to the class list\n");
  6. printf("7.delete student from class list\n");
  7. 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.

  1. switch (menuitem){
  2. case 1:
  3. // print list
  4. break;
  5. case 2:
  6. // print list of A students
  7. break;
  8. ...
  9. ....
  10.  
  11. default:
  12. break;
  13. }
Reputation Points: 161
Solved Threads: 43
Posting Whiz
stilllearning is offline Offline
309 posts
since Oct 2007
Jun 3rd, 2009
0

Re: help plz with grading program

"Please don't kill the codes,Pay them some respect "
After all,they are "your" codes:
  1. for(i=0;i {
  2. 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;
  3. }
Complete their format at least....

Errors:
>Usage of "&menu" in printf is not only syntactically wrong but also useless.Why do you want to print value of menu there???

>The code :
  1. printf("Input a Name! =");
  2. scanf("%s",&name[i]);
is incorrect usage.If you want to pick the i th name then
  1. scanf("%s",name[i]);
is enough as per your declaration of name array.
Last edited by csurfer; Jun 3rd, 2009 at 2:56 pm.
Reputation Points: 485
Solved Threads: 88
Posting Pro
csurfer is offline Offline
564 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: creating fixed length file
Next Thread in C Forum Timeline: Fetching web pages in C / a simple wget equivalent?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC