Home » questions » C++ question?

C++ question?

2006-07-30 14:17:59, Category: Programming & Design
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?? Please show how we could use 4 parallel arrays to hold student scores(3 for each exam, and one string array for student names). Also four parallel arrays to hold the cut-offs and totals(3 for the cut-offs and one for the totals) Totals do not require an array. I really do not know where to start. Arrays are confusing!! Thanks a million!! 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 Ann 77=B 85=A 81=B 253=B I appreciate your answers but i am required to use parallel one-dimensional arrays for this one. I am yet to study 2 or other multi-dimensional arrays. THANKS!!

Answers

  1. stopxsnap

    On 2006-07-30 14:19:43


    WTF? Is it school already?
  2. Mark H

    On 2006-07-30 16:26:29


    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.
  3. I Know Nuttin, Special Agent

    On 2006-07-30 14:24:06


    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.
  4. avramti

    On 2006-07-30 14:29:41


    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!!!
  5. kris

    On 2006-07-30 14:24:45


    AAAAAHHHHHHHHHHH I HATE MATHMATICAL OUESTIONS