/*Tyler Taormina *Module 11a *Matrix Practice */ #include #include #include using namespace std; #define ARRAY_SIZE 10 int readData(int[ARRAY_SIZE][2], string[ARRAY_SIZE][2]); void printData(int[ARRAY_SIZE][2], string[ARRAY_SIZE][2], int[ARRAY_SIZE], int); void calcData(int[ARRAY_SIZE][2], int[ARRAY_SIZE]); int main() { int COUNTER; int award[ARRAY_SIZE]; int id_numStu[ARRAY_SIZE][2]; string pres_club[ARRAY_SIZE][2]; COUNTER = readData(id_numStu, pres_club); calcData(id_numStu, award); printData(id_numStu, pres_club, award, COUNTER); } void printData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2], int awardData[ARRAY_SIZE], int ctr) { cout << setw(20) << left << "Student Club" << left << setw(20) << "President" << setw(20) << left << "Number of Students" << setw(20) << left << "Award" << endl; // Headings for the columns ^^ cout << "=============================================================================" << endl; for (int i = 0; i < ctr; i++) { for (int j = 0; j < 1; j++) { cout << setw(20) << left << stringData[i][j] << setw(20) << left << stringData[i][j+1] << setw(20) << left << intData[i][j+1] << setw(20) << left << awardData[i] << endl; } } } int readData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2]) { int again = 1, i = 0, num_stu = 0, counter = 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++; counter++; } } cout << endl; return counter; } void calcData(int intData[ARRAY_SIZE][2], int awardData[ARRAY_SIZE]) { int award = 75; int i; for (i = 0; i < ARRAY_SIZE; i++) { awardData[i] = intData[i][1] * award; } }