Please help me:(

The overall marks of the students in a particular class of 25 for 4 subjects CPPS, DFUND1, CKT AND EMATHS are maintained as arrays in an external data file. Assume that the arrays have already been initialized with values.
The following is a sample of the marks recorded for the class:
stud[0] stud[1] stud[2] stud [3]..................................stud[24]
cpps; 75 80 45 23 .................................................95
dfund1;77 65 26 99.................................................39
ckt; 100 55 44 85 ..................................................69
emaths;58 78 65 48................................................. 74
For your project declare initialized arrays for the 4 subjects with your sample values.
Write a program to show menu options that allows the user to display:
1. The marks of all 4 subjects for a student using a student ID 1 to 25
2. The number of grade A, B, C, D and F for the selected subject.
3. The average mark for the given subject.
Last edited on
You could create a struct containing the subjects. Then make an array of the struct, each index representing a student.
So how do i make it like display:
studentID[5]: cpps 78 , dfund1 55, ckt 65 emaths 63

.int cpps[] ={75, 80, 45, 23, 66, 77, 88, 49, 55, 82, 91, 87, 72, 55, 46, 69, 95, 82, 83, 84, 33, 85, 90, 100, 76};
int dfund1[]={77, 85, 65, 48, 55, 58, 59, 63, 12, 21, 85, 89, 67, 82, 55, 88, 93, 77, 85, 42, 99, 89, 88, 87, 70};
int ckt[]={65, 80, 64, 45, 59, 82, 64, 87, 69, 79, 24, 44, 96, 77, 95, 33, 75, 50, 51, 76, 80, 80, 89, 95, 76};
int emaths[]={85, 78, 65, 48, 35, 73, 91, 90, 56, 62, 88, 82, 82, 80, 79, 66, 69, 17, 86, 90, 100, 100, 100, 100, 78};


for the separate data file, is it okay to be like this?
You could do it that way I suppose. Then you would do something like:

You would simply do std::cout << "cpps " << cpps[5] << "dfund1 " << dfund1[5] < ect.... Though you would replace 5 with the selected student(-1 maybe unless you are going to have them enter student 0 as first).
Topic archived. No new replies allowed.