aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab5/Functions.cpp
diff options
context:
space:
mode:
authorJoseph Ten Eyck <[email protected]>2021-11-02 22:23:12 -0700
committerJoseph Ten Eyck <[email protected]>2021-11-02 22:23:12 -0700
commitca83580bd87e4e96ab6f33539840f6def0af5d94 (patch)
treef11cae9967497dd746df67a2aa458decc7a03b03 /CST116F2021-Lab5/Functions.cpp
parentAdd online IDE url (diff)
downloadcst116-lab5-josephteneyck-master.tar.xz
cst116-lab5-josephteneyck-master.zip
Joseph Ten Eyck - Lab 5 Homework.HEADmaster
Diffstat (limited to 'CST116F2021-Lab5/Functions.cpp')
-rw-r--r--CST116F2021-Lab5/Functions.cpp172
1 files changed, 172 insertions, 0 deletions
diff --git a/CST116F2021-Lab5/Functions.cpp b/CST116F2021-Lab5/Functions.cpp
new file mode 100644
index 0000000..622941f
--- /dev/null
+++ b/CST116F2021-Lab5/Functions.cpp
@@ -0,0 +1,172 @@
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// CODE FOR PROBLEM #1 (LEARN BY DOING) ON PAGE 253 IS BELOW
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+//#include "Header.h"
+//
+////puts scores into array
+//void GetInput(float currStudent[], int NUM_SCORES)
+//{
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": ";
+// cin >> currStudent[i];
+// }
+//}
+//
+////translates scores to grades and puts into another array
+//void ScoreToGrade(float currStudent[], char currStudGradeLTR[], int NUM_SCORES)
+//{
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// 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';
+// }
+// }
+//}
+//
+////finds sum and average of scores
+//void ScoreAvg(float currStudent[], int NUM_SCORES, float& scoreSum, float& scoreAvg)
+//{
+// scoreSum = 0.0;
+// scoreAvg = 0.0;
+//
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// scoreSum += currStudent[i];
+// }
+//
+// scoreAvg = scoreSum / NUM_SCORES;
+//}
+//
+////counts frequency of different letter grades
+//void Frequency(char currStudGradeLTR[], int NUM_SCORES, int& freqA, int& freqB, int& freqC, int& freqD, int& freqF)
+//{
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// 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++;
+// }
+// }
+//}
+//
+////displays list of scores with letter grades and class analysis
+//void Display(float currStudent[], char currStudGradeLTR[], float scoreSum, float scoreAvg, int freqA, int freqB, int freqC, int freqD, int freqF, int NUM_SCORES)
+//{
+// for (int i = 0; i < NUM_SCORES; i++)
+// {
+// cout << right << "\n\tScore #" << setw(2) << setfill(char(32)) << i + 1 << ": "
+// << setw(7) << setfill(char(32)) << left << currStudent[i] << " " << currStudGradeLTR[i];
+// }
+//
+// cout << "\n========================================================";
+// 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;
+//}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// CODE FOR PROBLEM #2 (LEARN BY DOING) ON PAGE 260 IS BELOW
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+//#include "Header.h"
+//
+////prompts for first and last name and puts them into arrays
+//void getInput(char firstName[], char lastName[])
+//{
+// cout << "\n\n\tEnter first name: ";
+// cin.getline(firstName, 61);
+//
+// cout << "\n\tEnter last name: ";
+// cin.getline(lastName, 61);
+//}
+//
+////combines first and last names into another array, adds a comma and space between them
+//void nameCombine(char firstName[], char lastName[], char fullName[])
+//{
+// int index = 0;
+//
+// for (int i = 0; lastName[i] != '\0'; i++) //puts lastName into fullName
+// {
+// fullName[i] = lastName[i];
+// }
+//
+// for (int i = 0; fullName[i] != '\0'; i++) //counts fullName current length
+// {
+// index++;
+// }
+//
+// fullName[index] = ','; //adds comma and space
+// fullName[index + 1] = ' ';
+//
+// for (int i = 0; firstName[i] != '\0'; i++)
+// {
+// fullName[i + index + 2] = firstName[i];
+// }
+//}
+//
+////displays full name from array
+//void display(char firstName[])
+//{
+// cout << "\n\n====================================================";
+// cout << "\n\n\tYour full name is: " << firstName << "\n" << endl;
+//}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// CODE FOR PROBLEM #7 (EXERCISES) ON PAGE 273 IS BELOW
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+//#include "Header.h"
+//
+////compares the first 6 characters of the two strings
+//void compareStrings(char string_1[], char string_2[], int& flag)
+//{
+// for (int i = 0; i <= 5; i++)
+// {
+// if (string_1[i] != string_2[i])
+// {
+// flag++;
+// }
+// }
+//} \ No newline at end of file