Hi there! I'm a beginner programming student and i was given this homework yesterday. im very confused and having a hard time making it run properly can you guys help me out on this one?
2. define a studentType struct with the following members:
2.a lastName
2.b firstName
2.c programme (e.g. BSA, BSIT) 2.d an array to hold the courses Taken.
You haven't defined the array of courses taken by a student.
Your studentType has a middle name, which isn't required.
You have nearly-working code and fixing the remaining problems wouldn't really teach you much so I'm going to give you working code:
- I changed coursename to coursenum in the courseinfo struct
- I removed the middlename from studentinfo and added the array of courses.
- Added cin.ignore(1000, '\n'); to input. This causes it to skip over the newline after you enter the grade. Without this code, when you prompts for the second student's name, it will read that pending newline as their last name and then all hell breaks loose.
- I assume that qpicalc() does all the right stuff, but I'm not familiar with this calculation so I can't be sure. Nice job here. In similar posts, other students have struggled with this sort of thing.
- rewrote main() to have an array of 2 students, get their input and print the results.
You will still need to add some code to determine which student has the highest qpi. I suggest that you store the qpi into a variable before printing it.