forked from ChicoState/MyFave
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (26 loc) · 657 Bytes
/
main.cpp
File metadata and controls
32 lines (26 loc) · 657 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
#include <iostream>
#include <vector>
using std::cout, std::cin, std::endl, std::string, std::vector;
int main(){
string input = "";
vector<string> list;
do{
if( list.size() == 0 ){
cout << "What is your favorite?\n";
}
else{
cout << "What is your next favorite?\n";
}
// Use getline to capture the entire line
getline(cin, input);
// Check if input is "done" and don't add it to the list
if (input != "done") {
list.push_back(input);
}
}while( input != "done" );
cout << "Your favorite list:\n";
for(int i = 0; i < list.size(); i++){
cout << list.at(i) << endl;
}
return 0;
}