-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ19.cpp
More file actions
33 lines (25 loc) · 686 Bytes
/
Q19.cpp
File metadata and controls
33 lines (25 loc) · 686 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
#include <iostream>
#include <vector>
using namespace std;
void getData(vector<string> & names, vector<int> & scores) {
while (true) {
string name;
int score;
cin >> name >> score;
if (name == "NoName" && score == 0) {
break;
}
names.push_back(name);
scores.push_back(score);
}
}
int main() {
cout << "enter a set of name-and-value pairs separated with space" <<endl;
vector<string> names;
vector<int> scores;
getData(names, scores);
for (int i = 0; i < names.size(); i++) {
cout << names[i] << " " << scores[i] << endl;
}
return 0;
}