diff options
Diffstat (limited to 'CST116F2021-Lab5/CST116-lab5-Functions.cpp')
| -rw-r--r-- | CST116F2021-Lab5/CST116-lab5-Functions.cpp | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/CST116F2021-Lab5/CST116-lab5-Functions.cpp b/CST116F2021-Lab5/CST116-lab5-Functions.cpp new file mode 100644 index 0000000..6502081 --- /dev/null +++ b/CST116F2021-Lab5/CST116-lab5-Functions.cpp @@ -0,0 +1,130 @@ +// File: CST116-Lab_5-FUnctions.cpp +// Summary: A compilation of all function files in lab 5 +// Author: Logan Billingsley +// Date: 11/2/2021 + +#include "CST116-lab5.h" + + // 9b -- 10.6 Learn by Doing Exercises +/* +void GetScores(float scores[]) +{ + for (int i = 0; i < SIZE; i++) // Get scores + { + cout << "Please enter score " << i + 1 << ": "; + cin >> scores[i]; + cout << endl; + } + return; +} +void DisplayScores(float scores[], int& A, int& B, int& C, int& D, int& F) +{ + for (int i = 0; i < SIZE; i++) // Display scores and letter grade. + { + cout << "Score " << i + 1 << ": " << scores[i] << ' '; + if (scores[i] >= 92) + { + cout << "A\n\n"; + A++; + } + else if (scores[i] >= 84) + { + cout << "B\n\n"; + B++; + } + else if (scores[i] >= 75) + { + cout << "C\n\n"; + C++; + } + else if (scores[i] >= 65) + { + cout << "D\n\n"; + D++; + } + else + { + cout << "F\n\n"; + F++; + } + } + return; +} +void DisplayTotals(int A, int B, int C, int D, int F) +{ + cout << "There were a total of: \n" + << A << " A's\n" + << B << " B's\n" + << C << " C's\n" + << D << " D's\n" + << F << " F's\n\n"; + return; +} +*/ + + // 10a -- 10.7 Learn by Doing Exercies 2 +/* +void GetNames(char first[], char last[]) +{ + cout << "Input your first name: "; + cin >> first; + cout << endl; + cout << "Input your last name: "; + cin >> last; + cout << endl << endl; + return; +} +void FullName(char first[], char last[], char full[]) +{ + int i = 0; + for (int j = 0; last[j] != '\0'; j++) + { + full[i] = last[j]; + i++; + } + full[i] = ','; + i++; + full[i] = ' '; + i++; + for (int j = 0; first[j] != '\0'; j++) + { + full[i] = first[j]; + i++; + } + full[i] = '\0'; + return; +} +void PrintName(char full[]) +{ + cout << "Full Name: " << full << endl; + return; +} +*/ + + // 10b -- 10.8 Exercies 7 +/* +void GetString1(char string1[]) +{ + cout << "Please input name 1: "; + cin.getline(string1, SIZE); + cin.clear(); + cin.ignore(cin.rdbuf()->in_avail()); +} +void GetString2(char string2[]) +{ + cout << "Please input name 2: "; + cin.getline(string2, SIZE); +} +void CompareStrings(char string1[], char string2[]) +{ + int result; + + result = strncmp(string1, string2, 6); + + if (result == 0) + cout << "Same\n\n"; + else + cout << "Different\n\n"; + +} +*/
\ No newline at end of file |