aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab6/Functions.cpp
blob: c9625b0ab0847e9378ce62e8110fa1eaf996a668 (plain) (blame)
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
#include "Header.h"

//function getInput definition
void getInput(string studentClub, string presidentName, int numberOfStudents, string strClubIndex[10][2], int intClubIndex[], int& repeats)
{
	strClubIndex[repeats][0] = studentClub;
	strClubIndex[repeats][1] = presidentName;
	intClubIndex[repeats] = numberOfStudents;
}

//function calculateMoney definition
void calculateMoney(int intClubIndex[], int intClubMoneyIndex[], int repeats)
{
	for (int clubCount = 0; clubCount <= repeats; clubCount++)
	{
		intClubMoneyIndex[clubCount] = intClubIndex[clubCount] * 75;
	}
}



//function displayTable definition
void displayTable(string strClubIndex[10][2], int intClubIndex[], int intClubMoneyIndex[], int repeats)
{

    cout << "\n--Club Table--\n" << endl;
    cout << "Student Club";
    cout.width(10);
    cout << "President";
    cout.width(10);
    cout << "Number of Students";
    cout.width(10);
    cout << endl;

    for (int i = 0; i < repeats; i++)
    {
        cout << "| Club name: " << strClubIndex[i][0]
            << " | Club President: " << strClubIndex[i][1]
            << " | Number of Students: " << intClubIndex[i]
            << " | Club Money: " << intClubMoneyIndex[i] << " |"
            << endl;
    }

    cout << endl;
}