#include "CST116F2021-Lab5(Header).h" //9a - //Section 10.5 - //int main() //{ //create arrays // int studentScores[10]; // char studentGrades[10]; //loop input into array // for (int scoreCount = 0; scoreCount <= 9; scoreCount++) // { // cout << "Enter student " << scoreCount + 1 << "'s score: "; // cin >> studentScores[scoreCount]; // } //scores to grades loop // for (int scoreCount = 0; scoreCount <= 9; scoreCount++) // { // if (studentScores[scoreCount] >= 92.0) // { // studentGrades[scoreCount] = 'A'; // } // else if (studentScores[scoreCount] >= 84.0) // { // studentGrades[scoreCount] = 'B'; // } // else if (studentScores[scoreCount] >= 75.0) // { // studentGrades[scoreCount] = 'C'; // } // else if (studentScores[scoreCount] >= 65.0) // { // studentGrades[scoreCount] = 'D'; // } // else if (studentScores[scoreCount] < 65.0) // { // studentGrades[scoreCount] = 'F'; // } // } //display grades for each student // cout << endl; // for (int gradeCount = 0; gradeCount <= 9; gradeCount++) // { // cout << "Student " << gradeCount + 1 << "'s grade: " << studentGrades[gradeCount] << endl; // } //display class average // cout << endl; // float classAverage = 0; // for (int scoreCount = 0; scoreCount < 10; scoreCount++) // { // classAverage = classAverage + studentScores[scoreCount]; // } // cout << "Class average: " << classAverage/10 << endl; //display number of students per grade // cout << endl; // int studentAs = 0; // int studentBs = 0; // int studentCs = 0; // int studentDs = 0; // int studentFs = 0; // for (int gradeCount = 0; gradeCount < 10; gradeCount++) // { // if (studentGrades[gradeCount] == 'A') // { // studentAs++; // } // if (studentGrades[gradeCount] == 'B') // { // studentBs++; // } // if (studentGrades[gradeCount] == 'C') // { // studentCs++; // } // if (studentGrades[gradeCount] == 'D') // { // studentDs++; // } // if (studentGrades[gradeCount] == 'F') // { // studentFs++; // } // } // cout << studentAs << " students got A's" << endl; // cout << studentBs << " students got B's" << endl; // cout << studentCs << " students got C's" << endl; // cout << studentDs << " students got D's" << endl; // cout << studentFs << " students got F's" << endl; //} //9b - //Section 10.6 //Function Prototypes //void getScores(int studentScores[]); //void calculateGrades(int studentScores[], char studentGrades[]); //void displayGrades(char studentGrades[]); //void classAverage(int studentScores[]); //void studentsPerGrade(char studentGrades[]); //int main() //{ //defining // int studentScores[10]; // char studentGrades[10]; //entry sequence // cout << "Welcome to the 10 scores to grades program." << endl; //get scores // cout << endl; // getScores(studentScores); //calculate grades // calculateGrades(studentScores, studentGrades); //display grades // cout << endl; // displayGrades(studentGrades); //display class average // cout << endl; // classAverage(studentScores); //display students per grade // cout << endl; // studentsPerGrade(studentGrades); // return 0; //} //void getScores(int studentScores[]) //{ // for (int scoreCount = 0; scoreCount < 10; scoreCount++) // { // cout << "Please enter student " << scoreCount + 1 << "'s score: "; // cin >> studentScores[scoreCount]; // } //} //void calculateGrades(int studentScores[], char studentGrades[]) //{ // for (int scoreCount = 0; scoreCount < 10; scoreCount++) // { // if (studentScores[scoreCount] >= 92.0) // { // studentGrades[scoreCount] = 'A'; // } // else if (studentScores[scoreCount] >= 84.0) // { // studentGrades[scoreCount] = 'B'; // } // else if (studentScores[scoreCount] >= 75.0) // { // studentGrades[scoreCount] = 'C'; // } // else if (studentScores[scoreCount] >= 65.0) // { // studentGrades[scoreCount] = 'D'; // } // else if (studentScores[scoreCount] < 65.0) // { // studentGrades[scoreCount] = 'F'; // } // } //} //void displayGrades(char studentGrades[]) //{ // for (int gradeCount = 0; gradeCount < 10; gradeCount++) // { // cout << "Student " << gradeCount + 1 << "'s final grade: " << studentGrades[gradeCount] << endl; // } //} //void classAverage(int studentScores[]) //{ // float classAverage = 0; // for (int scoreCount = 0; scoreCount < 10; scoreCount++) // { // classAverage = classAverage + studentScores[scoreCount]; // } // cout << "Class average: " << classAverage / 10 << endl; //} //void studentsPerGrade(char studentGrades[]) //{ // int studentAs = 0; // int studentBs = 0; // int studentCs = 0; // int studentDs = 0; // int studentFs = 0; // for (int gradeCount = 0; gradeCount < 10; gradeCount++) // { // if (studentGrades[gradeCount] == 'A') // { // studentAs++; // } // if (studentGrades[gradeCount] == 'B') // { // studentBs++; // } // if (studentGrades[gradeCount] == 'C') // { // studentCs++; // } // if (studentGrades[gradeCount] == 'D') // { // studentDs++; // } // if (studentGrades[gradeCount] == 'F') // { // studentFs++; // } // } // cout << studentAs << " students got A's" << endl; // cout << studentBs << " students got B's" << endl; // cout << studentCs << " students got C's" << endl; // cout << studentDs << " students got D's" << endl; // cout << studentFs << " students got F's" << endl; //} //10a //9.4 Learn by Doing Exercises (broken into 3 files) //int main() //{ //defining arrays // char firstName[15] = {}; // char lastName[15] = {}; //get firstName and lastName (call function getName) // getName(firstName, lastName); //format full name (call function formatName) // formatName(firstName, lastName); // return 0; //} //10b //9.5 Learn by Doing Exercises (broken into 3 files) int main() { //defining arrays char firstString[30] = {}; char secondString[30] = {}; //greeting cout << "Welcome to the string first six character comparison program.\n"; //get string inputs (call function getStrings) getStrings(firstString, secondString); //compare string inputs (call function compareStrings) compareStrings(firstString, secondString); }