im making a grade book code using functions and SINGLE arrays (multi arrays would be easier, but my teacher wants this in our code)
outline:
from main() ask the user for info about 4 students
---> use functions getStudentInfo() 4x (once per student; im assuming this will have the students names)
----> call ComputerAverage() 4x from main (average of students grades. they will have 5 grades, where the lowest will be dropped and then averaged together)
----> call PrintGradeInfo() 4x as well to print grade, pausing in between each student so user can view all info (pause is a function as well)
example of output:
Enter Name of Student: Billy Bob
Score 1: 100
Score 2: 100
Score 3: 100
Score 4: 100
Score 5: 100
here is grade info:
Billy Bob
Exam Scores: 100 100 100 100 100
Average: 100
Grade: A
Hit enter key to continue...
etc...
(it should show this once the data for all 4 students entered)
for the names i will be using the getline function
and using a for loop to drop the lowest score and each student has its own 1 dimensional array
this is my concept so far:
#include <iostream>
#include <string> // for student names
using namespace std;
//function prototypes
void GetStudentInfo(string& name, int scores[]);
int LowestScore (const int scores[]);
void ComputeAveAndGrade (const int scores[], double& average, char& grade);
void PrintGradeInfo (const string& name, const int scores[], double average, char grade);
void Pause();
int main()
{
// function calls
GetStudentInfo (name[0], scoreS0);
DetermineGrade (scoreS0. average[0], grade[0]);
PrintStudentInfo(name[0], scoreS0, average[0], grade[0]);
// there are more to call, this is just the beginning since i have 4 students
Pause();
return 0;
}
// functions here
this is how the layout should be according to my professor, but she didnt elaborate much as to WHY it should be like this
all the code that is in green is the ones that i am confused on (like why are passed by references being used? and what will the array do??)
im also confused on how to write the functions and strings itself (my book does a pathetic job by taking only 2 pages to cover strings)
if you could explain to me what is going on in the code-it would really help me understand!
thanks guys! :-)