-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (33 loc) · 859 Bytes
/
Copy pathmain.cpp
File metadata and controls
40 lines (33 loc) · 859 Bytes
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
#include <iostream>
#include <string>
#include <vector>
#include "Winners.h"
using namespace std;
void fillvector(vector<Winners>&);
void printvector(vector<Winners>&);
int main(){
vector<Winners> contestants;
fillvector(contestants);
printvector(contestants);
system("pause");
return 0;
}
void fillvector(vector<Winners>& newContestant){
string name;
int age;
for (int i = 0; i < 4; i++){
cout << "Enter the name of the contestant";
cin >> name;
cout << " Enter the age of the contestant";
cin >> age;
Winners Contestant(name, age);
newContestant.push_back(Contestant);
}
cout << endl;
}
void printvector(vector<Winners>& newContestant){
for (unsigned int i = 0; i < 4; i++){
cout << " Contestant name :" << newContestant[i].getname() << endl;
cout << "Contestant age :" << newContestant[i].getage() << endl;
}
}