diff options
| author | till-t <[email protected]> | 2021-11-03 18:38:58 -0700 |
|---|---|---|
| committer | till-t <[email protected]> | 2021-11-03 18:38:58 -0700 |
| commit | 9b31775b416bcbbae8c73f16b2c4c6a368cd62f2 (patch) | |
| tree | cfa687624803b95775c0bc49bc2ea0005b22ebf8 | |
| parent | Push check. (diff) | |
| download | cst116-lab6-till-t-9b31775b416bcbbae8c73f16b2c4c6a368cd62f2.tar.xz cst116-lab6-till-t-9b31775b416bcbbae8c73f16b2c4c6a368cd62f2.zip | |
November 3, 2021 update to Lab 6.
Still incomplete at this time.
| -rw-r--r-- | lab6_taormina.txt | 43 | ||||
| -rw-r--r-- | mod11a.cpp | 83 |
2 files changed, 126 insertions, 0 deletions
diff --git a/lab6_taormina.txt b/lab6_taormina.txt new file mode 100644 index 0000000..5ed8f9f --- /dev/null +++ b/lab6_taormina.txt @@ -0,0 +1,43 @@ +Module 6: Lab 6 + +Tyler Taormina + +CST 116 +_______________________________________________________________________________ +11a +10.10 Learn By Doing +pg 282-283 +#1 for 10pts + + +CODE: + + +RUN: + + + +_______________________________________________________________________________ +11b 10.14 Debugging Exercises +pg 289-292 +#1 for 10pts + +CODE: + +RUN: + + +_______________________________________________________________________________ +11c +10.15 Programming Exercises +pg 292-293 +#1 for 10pts + +CODE: + +RUN: + + +_______________________________________________________________________________ + + diff --git a/mod11a.cpp b/mod11a.cpp new file mode 100644 index 0000000..975c772 --- /dev/null +++ b/mod11a.cpp @@ -0,0 +1,83 @@ +/*Tyler Taormina + *Module 11a + *Matrix Practice + */ + +#include <iostream> +#include <cstring> +#include <iomanip> +using namespace std; + +#define ARRAY_SIZE 10 + +void readData(int[ARRAY_SIZE][2], string[ARRAY_SIZE][2]); + +void printData(int[ARRAY_SIZE][2], string[ARRAY_SIZE][2], int[ARRAY_SIZE]); +void calcData(int[ARRAY_SIZE][2], int[ARRAY_SIZE]); + +int main() +{ + int award[ARRAY_SIZE]{}; + int id_numStu[ARRAY_SIZE][2]{}; + string pres_club[ARRAY_SIZE][2]{}; + readData(id_numStu, pres_club); + printData(id_numStu, pres_club, award); + calcData(id_numStu, award); +} + + + +void printData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2], int awardData[ARRAY_SIZE]) +{ + cout << setw(10) << "Student Club" << setw(10) << " President" << setw(10) << " Number of Students" << setw(10) << " Award\n" << endl; + // Headings for the columns ^^ + + for (int i = 0; i < ARRAY_SIZE; i++) + { + for (int j = 0; j < 1; j++) + { + cout <<stringData[i][j] << setw(20) << stringData[i][j+1] << setw(20) << intData[i][j+1] << setw(20) << awardData[j] << endl; + } + } + +} + +void readData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2]) +{ + int again = 1, i = 0, num_stu = 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 of the club: "; + getline( cin >> ws, stringData[i][0]); + cout << "Enter the President of the club: "; + getline( cin >> ws, stringData[i][1]); + cout << "Enter the number of students in the club: "; + cin >> num_stu; + intData[i][1] = num_stu; + cout << endl; + i++; + } + + + } + cout << endl; + +} + + +void calcData(int intData[ARRAY_SIZE][2], int awardData[ARRAY_SIZE]) +{ + int award = 75; + int i = 0; + + for (i = 0; i < ARRAY_SIZE; i++) + { + int num_stu = intData[i][1]; + awardData[i] = num_stu * award; + } +} |