I need help help calculating and updating the total grade for a structure student inside an array.
In C++? Have you tried the source code, if so?
yes, for c++
and what do you mean source code?
I'm getting data from a file with various parts i.e id, first name, last name, midterm, final,quizzes, labs, projects
and these things make up the structure student
Like, have you attempted the code and get errors? If so, would you mind posting so I give a quick look? I gotta go in 10 minutes and won't be back til tomorrow. I don't mind helping though
okay
I am using functions
void fillArrayFromFile(ifstream& ins,student studentArray[], int& numberOfStudents, int weightMidterm, int weightFinal, int weightQuizzes, int weightLabs, int weightProjects) { int id; string firstName; string lastName;; string line; numberOfStudents = 0; while (!ins.eof()) { ins >> studentArray[numberOfStudents].id >> studentArray[numberOfStudents].first >> studentArray[numberOfStudents].last >> studentArray[numberOfStudents].midterm >> studentArray[numberOfStudents].final >> studentArray[numberOfStudents].quizzes >> studentArray[numberOfStudents].labs >> studentArray[numberOfStudents].project; numberOfStudents++; } } void updateTotalGrade(student studArray[], int index, int weightMidterm, int weightFinal, int weightQuizzes, int weightLabs, int weightProject) { int totalGrade; index = 0; for (int i = 0; i < index; i++) { } }
updateTotalGrade is called by fillArrayFromFile
@FortyTheRapper
So are you trying to create a struct like...? struct blahblah { }; Then wanting to print out the values of the files in main or the function?
just store the informantion in the struct
the struct is already created
struct student // stucture of type student. { int id; string first; string last; float midterm; float final; float quizzes; float labs; float project; float totalGrade; string letterGrade; };
this is what the file contains
@FortyTheRapper
Join our real-time social learning platform and learn together with your friends!