1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::string;
// Given an array "grades" with "size" items in it, find the maximum item
int max(int grades[], unsigned size)
{
}
// Same as max(), but finds the maximum value.
int min(int grades[], unsigned size)
{
}
// Prompt the user for their grade in the given subject. Keep doing it
// until they enter a value between 0 and 100 (inclusive)
int getGrade(const char *subject)
{
}
int main()
{
const unsigned NumSubjects = 6;
enum {English, Math, Life0, History, ComL, Art };
int grades[NumSubjects];
const char *subjects[NumSubjects] = { "English", "Math", "Life0",
"History", "ComL", "Art" };
int highest, lowest;
float avgYearMark;
string name, schoolName;
//studentDetails
cout<<"Please key in your name: ";
getline(cin,name,'\n');
cout<<"Please key in the name of your school: ";
getline(cin,schoolName,'\n');
grades[0] = getGrade("English");
for (unsigned i=0; i < NumSubjects; ++i) {
grades[i] = getGrade(subjects[i]);
}
highest = max(grades, 6);
lowest = min(grades, 6);
cout << "Highest = " << highest << '\n';
cout << "Lowest = " << lowest << '\n';
}
| |