-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.cpp
More file actions
58 lines (54 loc) · 1.52 KB
/
driver.cpp
File metadata and controls
58 lines (54 loc) · 1.52 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream>
#include<string>
#include "user_table.h"
using namespace std;
int main()
{
User_table U;
string input;
string cont = "NO";
do{
cout << "Enter operation" << endl;
cin >> input;
if (input == "UPSERT_USER")
{
string name;
string email;
string country;
cin >> name >> email >> country;
U.UPSERT_USER(name, country, email);
}
else if (input == "UPSERT_SCORE")
{
string email;
int score;
cin >> email >> score;
U.UPSERT_SCORE(email, score);
}
else if (input == "TOP_K")
{
int k;
string country = "";
cout << "input k " << endl;
cin >> k;
if (!cin.fail()){
cout << "is there a country " << endl;
string ans;
cin >> ans;
if (ans == "YES")
cin >> country;
U.TOP_K(k, country);
}
else{
cout << "Invalid k value " << endl;
cin.clear();
std::cin.ignore(256,'\n');
}
}
else
cout << "INVALID OPERATION" << endl;
cout << "want to continue?" << endl;
cin >> cont;
} while(cont == "YES" || cont == "yes" || cont == "y");
return 0;
}