//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CODE FOR PROBLEM #1 (LEARN BY DOING) ON PAGE 247 IS BELOW //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //#include //#include // //using namespace std; // //const int NUM_SCORES = 10; // //int main() //{ // float currStudent[NUM_SCORES]{ 0.0 }; // char currStudGradeLTR[NUM_SCORES]{}; // // float scoreSum = 0.0; // float scoreAvg = 0.0; // // int freqA = 0; // int freqB = 0; // int freqC = 0; // int freqD = 0; // int freqF = 0; // // cout << "\n\tSTUDENT SCORE GRADER AND SIMPLE CLASS ANALYSIS PROGRAM\n\n"; // // for (int i = 0; i < NUM_SCORES; i++) //puts scores into array // { // cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": "; // cin >> currStudent[i]; // } // // for (int i = 0; i < NUM_SCORES; i++) //translates scores to grades and puts into another array // { // if (currStudent[i] < 65.0) // { // currStudGradeLTR[i] = 'F'; // } // else if (currStudent[i] >= 65.0 && currStudent[i] < 75.0) // { // currStudGradeLTR[i] = 'D'; // } // else if (currStudent[i] >= 75.0 && currStudent[i] < 84.0) // { // currStudGradeLTR[i] = 'C'; // } // else if (currStudent[i] >= 84.0 && currStudent[i] < 92.0) // { // currStudGradeLTR[i] = 'B'; // } // else if (currStudent[i] >= 92.0) // { // currStudGradeLTR[i] = 'A'; // } // } // // for (int i = 0; i < NUM_SCORES; i++) //finds sum of scores // { // scoreSum += currStudent[i]; // } // // scoreAvg = scoreSum / NUM_SCORES; //finds class score average // // for (int i = 0; i < NUM_SCORES; i++) //counts frequency of different letter grades // { // if (currStudGradeLTR[i] == 'A') // { // freqA++; // } // if (currStudGradeLTR[i] == 'B') // { // freqB++; // } // if (currStudGradeLTR[i] == 'C') // { // freqC++; // } // if (currStudGradeLTR[i] == 'D') // { // freqD++; // } // if (currStudGradeLTR[i] == 'F') // { // freqF++; // } // } // // cout << "\n\n\t\t Score Grade"; // // for (int i = 0; i < NUM_SCORES; i++) //displays list of scores with letter grades // { // cout << right << "\n\tScore #" << setw(2) << setfill(char(32)) << i + 1 << ": " // << setw(7) << setfill(char(32)) << left << currStudent[i] << " " << currStudGradeLTR[i]; // } // // cout << "\n========================================================"; //displays class analysis (average and frequency of letter grades) // cout << "\n\n\tClass score average: " << scoreAvg; // cout << "\n\n\n\tFrequency of letter grades:"; // cout << "\n\n\t\tA: " << freqA; // cout << "\n\t\tB: " << freqB; // cout << "\n\t\tC: " << freqC; // cout << "\n\t\tD: " << freqD; // cout << "\n\t\tF: " << freqF << "\n\n" << endl; // // return 0; //} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CODE FOR PROBLEM #1 (LEARN BY DOING) ON PAGE 253 IS BELOW //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //#include "Header.h" // //int main() //{ // const int NUM_SCORES = 10; // // float currStudent[NUM_SCORES]{ 0.0 }; // char currStudGradeLTR[NUM_SCORES]{}; // // float scoreSum = 0.0; // float scoreAvg = 0.0; // // int freqA = 0; // int freqB = 0; // int freqC = 0; // int freqD = 0; // int freqF = 0; // // cout << "\n\tSTUDENT SCORE GRADER AND SIMPLE CLASS ANALYSIS PROGRAM\n\n"; // // //puts scores into array // GetInput(currStudent, NUM_SCORES); // // //translates scores to grades and puts into another array // ScoreToGrade(currStudent, currStudGradeLTR, NUM_SCORES); // // //finds sum and average of scores // ScoreAvg(currStudent, NUM_SCORES, scoreSum, scoreAvg); // // //counts frequency of different letter grades // Frequency(currStudGradeLTR, NUM_SCORES, freqA, freqB, freqC, freqD, freqF); // // // cout << "\n\n\t\t Score Grade"; // // // //displays list of scores with letter grades and class analysis // Display(currStudent, currStudGradeLTR, scoreSum, scoreAvg, freqA, freqB, freqC, freqD, freqF, NUM_SCORES); // // return 0; //} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CODE FOR PROBLEM #2 (LEARN BY DOING) ON PAGE 260 IS BELOW //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //#include "Header.h" // //int main() //{ // char firstName[61]{}; // char lastName[61]{}; // char fullName[121]{}; // // //fullName[0]{ '\32' }; // // cout << "\n\t\t========================================="; // cout << "\n\t\t First/last name combiner using arrays"; // cout << "\n\t\t========================================="; // // //prompts for first and last name and puts them into arrays // getInput(firstName, lastName); // // //combines first and last names into another array // nameCombine(firstName, lastName, fullName); // // //displays full name from array // display(fullName); // // return 0; //} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CODE FOR PROBLEM #7 (EXERCISES) ON PAGE 273 IS BELOW //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //#include "Header.h" // //int main() //{ // char string_1[] = "Frank"; // char string_2[] = "Franklyn"; // // int flag = 0; // // compareStrings(string_1, string_2, flag); // // if (flag != 0) // { // cout << "\n\tDifferent" << endl; // } // // else // { // cout << "\n\tSame" << endl; // } //}