-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (36 loc) · 953 Bytes
/
main.cpp
File metadata and controls
44 lines (36 loc) · 953 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
44
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <cctype>
#include <algorithm>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::vector;
using std::transform;
const vector <string> VALIDATION = {"Cool","Great","Perfect","Beautiful","Aw, yeah"};
string get_input_in_lowercase();
int main(){
string input;
int pick;
srand(time(0));
pick = rand() % VALIDATION.size();
cout << "What are you listening to?\n";
input = get_input_in_lowercase();
cout << VALIDATION[pick] << "! Let's listen to more\n";
do{
cout << "What's next?\n";
input = get_input_in_lowercase();
pick = rand() % VALIDATION.size();
cout << VALIDATION[pick] << "!\n";
}while( input != "nothing" );
return 0;
}
string get_input_in_lowercase(){
string in;
getline(cin,in);
transform(in.begin(), in.end(), in.begin(), [](unsigned char c){ return std::tolower(c); });
return in;
}