-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (45 loc) · 1.28 KB
/
Copy pathmain.cpp
File metadata and controls
47 lines (45 loc) · 1.28 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
#include <iostream>
#include "linklist.h"
#include "element.h"
#include <string>
using namespace std;
int main() {
freopen("my.out", "w", stdout);
string cmd, index;
AccountManager *accountManager = new AccountManager;
int value;
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> cmd;
if (cmd == "insert") {
cin >> index >> value;
accountManager->AddUser(index, value);
}
if (cmd == "delete") {
cin >> index >> value;
if (!accountManager->DeleteUser(index, value))
cout << "doesn't exist" << "\n";
}
if (cmd == "find") {
cin >> index;
account tmp;
accountManager->more = false;
accountManager->currentValue = 0;
while (true) {
pair<account,bool> pair=accountManager->FindAccount(index);
if (pair.second) {
tmp = pair.first;
accountManager->more= true;
cout << tmp.value << ' ';
} else {
if(!accountManager->more) cout << "null" ;
break;
}
}
std::cout<<"\n";
}
}
delete accountManager;
return 0;
}