Thread: C++ Help View Single Post
 10-07-2012, 02:49 AM PM User | #1 alexb9054 New to the CF scene   Join Date: Oct 2012 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts C++ Help Assignment Questions: 4. Calculate each student letter grade using a function, save the letter grade to another array defined in main function. 5. Return the count of the grades for each letter grade (A, B, C,D, F) using a function 6. Perform a selection sort on the number grade array into descending order and output them again using functions. I need some help on the last 3 questions of my assignment and I cannot figure out how to do it. Here's my code so far. I just don't know how to save them in an array etc. Other than that the program ran fine before I started adding the last few steps Code: ```#include #include #include #include using namespace std; //Global Function void averageMaxCalc(int scoreInput[5], int sumZ, double& sAverage, double& sAverageF); void studentScoreCalc(int scoreInput[5], int sum);//Function studentScore() void deviation(int scoreInput[5], int sum); int letterGradesA(int scoreInput[5], char letterDefined); //|=======================| //|======== Main =========| //|=======================| int main (char LetterDefined) { cout << "Welcome to the student score calculator program.\n\n"; //Variables int scoreInput[5], sum = 0, sumZ = 0; double sAverage, sAverageF; //Defined char letterDefined; char letterGrades[6]; for (int m = 0; m < 6; ++m) { letterDefined = letterGrades[m]; } //Functions Within Main() studentScoreCalc(scoreInput, sum);//Function StudentScore() averageMaxCalc(scoreInput, sumZ, sAverage, sAverageF);//Function averageMaxCalc() deviation(scoreInput, sum);//Function deviation() //letterGradesA() returned letterGradesA(scoreInput, letterDefined); system("pause"); return 0; } //|=====================================| //|=== 1. Student Input and Max/Less ===| //|=====================================| void studentScoreCalc(int scoreInput[5], int sum) { //Declearing Variables sum = 0; cout << "Please Enter Student Scores below: \n";//Outputs to Console //Sum is set to 0 //Looping countScore and i 15x for (int i = 0; i <5; i++) { cin >> scoreInput[i];//Creates User Input } } //|=================================| //|=== 2. Funtion averageMaxCalc ===| //|=================================| void averageMaxCalc(int scoreInput[5], int sumZ, double& sAverage, double& sAverageF) { sumZ = 0;//Set sumZ to 0; //Gets Sum Of All Numbers sumZ = scoreInput[0]+scoreInput[1]+scoreInput[2]+scoreInput[3]+scoreInput[4]; //Finds The Average sAverage = sumZ / 5;//Finds Average sAverageF = (sumZ%5)*2;//Finds Decimal cout << "The Sum Of All Scores Is: " <