// CST116F2021-Lab6.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include #include #include #include using namespace std; #define ARRAY_SIZE 10 void inputData(int[], string[][2]); void fundCalc(int[], int[]); void tableDisp(int[], int[], string[][2]); int main() { int student_number[ARRAY_SIZE]{}, fund_value[ARRAY_SIZE]{}; string club_pres_name[ARRAY_SIZE][2]{}; inputData(student_number, club_pres_name); fundCalc(student_number, fund_value); tableDisp(student_number, fund_value, club_pres_name); } void inputData(int inputStuNum[], string inputClubPres[][2]) { int i = 0; while (i < ARRAY_SIZE) { cout << "Please enter the club name: "; getline(cin >> ws,inputClubPres[i][0]); cout << "Please enter the club president: "; getline(cin >> ws,inputClubPres[i][1]); cout << "Please enter the number of students in " << inputClubPres[i][0] << ": "; cin >> inputStuNum[i]; cout << endl; i++; } cout << endl; } void fundCalc(int calcNumStu[], int calcFund[]) { int i = 0; while (i < ARRAY_SIZE) { calcFund[i] = calcNumStu[i] * 75; i++; } } void tableDisp(int dispNumStu[], int dispFund[], string dispClubPres[][2]) { int i = 0; cout << "Student Club\tPresident\tNumber of Students\tClub Fund" << endl; while (i < ARRAY_SIZE) { cout << dispClubPres[i][0] << '\t' << dispClubPres[i][1] << '\t' << dispNumStu[i] << '\t' << dispFund[i]; cout << endl; i++; } } ////temp //#define ARRAY_SIZE 5 //void readData(int[ARRAY_SIZE][2], string[ARRAY_SIZE][2]); // // ////temp //int main() //{ // int id_age[ARRAY_SIZE][2]{}; // string name_gender[ARRAY_SIZE][2]{}; // // readData(id_age, name_gender); // // return 0; //} // //void readData(int intData[ARRAY_SIZE][2], string stringData[ARRAY_SIZE][2]) //{ // int again = 1, i = 0; // // //while again holds a value other than 0, program will read true // while (again && i < ARRAY_SIZE) // { // cout << "Enter the ID (0 to exit): "; // cin >> again; // if (again) // { // intData[i][0] = again; // cout << "Enter the name: "; // cin >> stringData[i][0]; // cout << "Enter the age: "; // cin >> intData[i][1]; // cout << "Enter the gender: "; // cin >> stringData[i][1]; // cout << endl; // i++; // } // } // cout << endl; //}