summaryrefslogtreecommitdiff
path: root/CST116F2021-Lab6/Lab6ExerciseFunctions.cpp
diff options
context:
space:
mode:
authorBenjamin Schroeder <[email protected]>2021-11-03 16:32:52 -0700
committerBenjamin Schroeder <[email protected]>2021-11-03 16:32:52 -0700
commit5bcf8d36d9004dde2792a9e35159df253c90c2bb (patch)
tree47a075ca7fedd752fd2154389bbad07389dce3e0 /CST116F2021-Lab6/Lab6ExerciseFunctions.cpp
parentAdd online IDE url (diff)
downloadcst116-lab6-bensprogramma-5bcf8d36d9004dde2792a9e35159df253c90c2bb.tar.xz
cst116-lab6-bensprogramma-5bcf8d36d9004dde2792a9e35159df253c90c2bb.zip
Lab6 Exercises
Diffstat (limited to 'CST116F2021-Lab6/Lab6ExerciseFunctions.cpp')
-rw-r--r--CST116F2021-Lab6/Lab6ExerciseFunctions.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/CST116F2021-Lab6/Lab6ExerciseFunctions.cpp b/CST116F2021-Lab6/Lab6ExerciseFunctions.cpp
new file mode 100644
index 0000000..dd96a34
--- /dev/null
+++ b/CST116F2021-Lab6/Lab6ExerciseFunctions.cpp
@@ -0,0 +1,85 @@
+#include "Lab6_Header.h"
+/* /// This is an Example that Martha Showed us in class
+#define ARRAY_SIZE 5
+void readData(int[ARRAY_SIZE][2], string[ARRAY_SIZE][2]);
+
+
+int main()
+{
+ int id_age[ARRAY_SIZE][2]{};
+ string name_gender[ARRAY_SIZE][2]{};
+ readData(id_age, name_gender);
+}
+
+
+void readData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2])
+{
+ int again = 1, i = 0;
+
+ while (again && i < ARRAY_SIZE)
+ {
+ cout << "Enter the ID (0 to EXIT):";
+ cin >> again;
+ if (again)
+ {
+ intData[i][0] = again;
+ cout << "Enter the name: ";
+ getline(cin >> ws, stringData[i][0]);
+ cout << "Enter the age: ";
+ cin >> intData[i][1];
+ cout << "Enter the gender: ";
+ getline(cin >> ws,stringData[i][1];
+ cout << endl;
+ i++;
+ }
+ }
+ cout << endl;
+}
+
+*/
+
+
+
+
+//10.10 Learn by Doing p282-283
+void readData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2])
+{
+ int again = 0, i = 0;
+ cout << "Another Club's Data? (1 for YES, 0 to exit) ";
+ cin >> again;
+ while (again && i < ARRAY_SIZE)
+ {
+ cout << "Enter the club name: ";
+ getline(cin >> ws, stringData[i][0]);
+ cout << "Enter number of members:";
+ cin >> intData[i][0];
+ cout << "Enter the Club president's name: ";
+ getline(cin >> ws, stringData[i][1]);
+ intData[i][1] = intData[i][0] * 75;
+ cout << endl;
+ cout << "Another Club's Data? (1 for YES, 0 to exit)";
+ cin >> again;
+ i++;
+ }
+
+
+ cout << endl;
+}
+
+void printData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2])
+{
+ cout << setw(20) << "\t\t\tClub" << setw(10) << "\t\tmembers" << setw(20) << "\tPresident" << setw(10) << "\t\tDues $$\n\n";
+ for (int i = 0; i < ARRAY_SIZE; i++)
+ {
+ cout << "Record " << i + 1 << " is: \t";
+ for (int j = 0; j < 2; j++)
+ {
+ cout << setw(30) << stringData[i][j] << setw(10) << intData[i][j];
+
+ }
+ cout << endl;
+ }
+}
+
+
+