diff options
Diffstat (limited to 'CST116F2021-Lab6/CST116F2021-Lab6.cpp')
| -rw-r--r-- | CST116F2021-Lab6/CST116F2021-Lab6.cpp | 127 |
1 files changed, 65 insertions, 62 deletions
diff --git a/CST116F2021-Lab6/CST116F2021-Lab6.cpp b/CST116F2021-Lab6/CST116F2021-Lab6.cpp index ec6933d..d5ca393 100644 --- a/CST116F2021-Lab6/CST116F2021-Lab6.cpp +++ b/CST116F2021-Lab6/CST116F2021-Lab6.cpp @@ -1,70 +1,73 @@ // CST116F2021-Lab6.cpp : This file contains the 'main' function. Program execution begins and ends there. // -#include <iostream> -#include <string> -#include <iomanip> -#include <cstring> -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" << setw(30) << "President" << setw(25) << "Number of Students" << setw(15)<< "Club Fund" << endl; - while (i < ARRAY_SIZE) - { - cout << setw(26) << dispClubPres[i][0] << setw(16) << dispClubPres[i][1] << setw(22) << dispNumStu[i] << setw(15) << dispFund[i]; - cout << endl; - i++; - } - -} +//p.282 +//#include <iostream> +//#include <string> +//#include <iomanip> +//#include <cstring> +// +//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" << setw(30) << "President" << setw(25) << "Number of Students" << setw(15)<< "Club Fund" << endl; +// while (i < ARRAY_SIZE) +// { +// cout << setw(26) << dispClubPres[i][0] << setw(16) << dispClubPres[i][1] << setw(22) << dispNumStu[i] << setw(15) << dispFund[i]; +// cout << endl; +// i++; +// } +// +//} ////temp //#define ARRAY_SIZE 5 |