1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
// CST116F2021-Lab6.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//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
//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;
//}
|