Saturday, May 22, 2010

C++ question?

This prgm is supposed to read from the input file


containing student scores for 3 exams to calculate a


grading curve and output a report showing scores and


grades.





The grading curve is as follows:


90% of the highest score in each exam= bottom of 'A'


grade


80% of the highest score in each exam= bottom of 'b'


grade


70% of the highest score in each exam= bottom of 'c'


grade


60% of the highest score in each exam= bottom of 'c'


grade





e.g of input file would be





John 83 92 86


Peter 74 79 87


Ann 77 85 81


Will 66 72 70


Oje 80 91 77


Ben 94 89 89











The output would be:


Exam 1: Exam2: Exam 3: Total:


A cut-off= 85 83 80 248


B cut-off= 75 74 71 220


C cut-off= 66 64 62 192


D cut-off= 56 55 53 164





Student results and grades:


John 83=B 92=A 86=A 261=A


Peter 74=C 79=B 87=A 240=B


etc.


Any ideas??

C++ question?
DId you consider using records instead of multiple arrays?


In your case you can use a single array (not 6...). Here is how:





typedef struct grades {char* name, int fg,int sg,int tg} list_name;





And now declaring the array:





list_name x[100];





This will store all the info you need... The output is very easy!!!
Reply:WTF? Is it school already?
Reply:It would seem that answering this might lead to you using the answer for a class ... and would that be cheating. Learning is about growing (and struggling) and though creative solutions are a good thing, creativite cheating is not.
Reply:I could write this program for you but honestly I am just too lazy. C++ isn't that hard.





All you have to do is use the "cin" stream object to read from the file, then use spaces as delimiters. I would declare a separate class to do this. That way, you could use objects from a class (or even just structures) to hold the student's name and scores.





The rest is just adding up the scores and averaging them, which can easily be done through nested loops that step through the arrays. E-mail me if you want any help, but I won't be home until much later tonight.
Reply:AAAAAHHHHHHHHHHH I HATE MATHMATICAL OUESTIONS

flowering plum

No comments:

Post a Comment