Created
October 20, 2017 21:36
-
-
Save mxdi9i7/7b9ea161b4e15e3833434247a79afe28 to your computer and use it in GitHub Desktop.
idk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
// Write definition for getAverage Function | |
double getAverage(string className) { | |
double classAvg; | |
cout << "Please enter your average for subject " << className << "." << endl; | |
cin >> classAvg; | |
if (classAvg < 0 || classAvg > 100) { | |
cout << "Please enter a number between 0 and 100 !" << endl; | |
cin >> classAvg; | |
} | |
return classAvg; | |
} | |
// Write definition for findHighestAverage Function | |
void getHighestAverage(double englishAvg,double mathAvg,double spanishAvg, double scienceAvg) { | |
double allAvg[4] = {englishAvg, mathAvg, spanishAvg, scienceAvg}; | |
string allSubjectNames[4] = {"english", | |
double x = 0.00; | |
string subjectName; | |
for (int i = 0; i < 4; i ++) { | |
if (allAvg[i] > x) { | |
x = allAvg[i]; | |
} | |
} | |
for (int i = 0; i < 4; i ++) { | |
if ( | |
} | |
cout << "Your highest class average is " << x << endl; | |
} | |
int main() { | |
// Declare necessary variables | |
// Call getAverage function for each of the four subjects - English, Math, Spanish, Science | |
double englishAvg = getAverage("english"); | |
double mathAvg = getAverage("math"); | |
double spanishAvg = getAverage("spanish"); | |
double scienceAvg = getAverage("science"); | |
// Call findHighestAverage function | |
getHighestAverage(englishAvg, mathAvg, spanishAvg, scienceAvg); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#include
#include
using namespace std;
// Write definition for getAverage Function
double getAverage(string className) {
double classAvg;
cout << "Please enter your average for subject " << className << "." << endl;
cin >> classAvg;
if (classAvg < 0 || classAvg > 100) {
cout << "Please enter a number between 0 and 100 !" << endl;
cin >> classAvg;
}
return classAvg;
}
// Write definition for findHighestAverage Function
void getHighestAverage(double englishAvg,double mathAvg,double spanishAvg, double scienceAvg) {
}
int main() {
// Declare necessary variables
}