-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample_Code_V6.cpp
More file actions
43 lines (39 loc) · 935 Bytes
/
Copy pathExample_Code_V6.cpp
File metadata and controls
43 lines (39 loc) · 935 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
41
42
43
#include <iostream>
using namespace std;
#include <set>
#include <string>
int main()
{
cout << "what serve is in your bag?" << endl;
set<string> s;
bool a = true;
while (a == true)
{
string serve;
cout << "enter a serve: " << endl;
cin >> serve;
s.insert(serve);
cout << "do you want to add another serve? (y/n): " << endl;
char choice;
cin >> choice;
if (choice == 'n' || choice == 'N')
{
break;
}
}
cout << "size of set: " << s.size() << endl;
if (s.contains("topper"))
{
cout << "watch out for the topper!" << endl;
}
if (s.contains("floater"))
{
cout << "watch out for the floater!" << endl;
}
for (auto it = s.begin(); it != s.end(); ++it)
{
cout << *it << ", ";
}
cout << endl;
return 0;
}