-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (42 loc) · 1.09 KB
/
main.cpp
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
#include <stdio.h>
#include "string.h"
#include "load.h"
#include "query.h"
#include "fileException.h"
#include "fileOpenException.h"
int main(int argc, char* argv[]) {
if (argc != 3) {
printf("Illegal command!\n");
return 0;
}
if(strcmp(argv[1],"load") == 0) {
if(strcmp(argv[2], "orders") == 0) {
try {
load *l = new load();
delete l;
} catch (FileException& f) {
f.print();
}
} else {
printf("Only orders can be loaded!\n");
}
}
else if (strcmp(argv[1], "retrieve") == 0) {
if (strcmp(argv[2], "orders") == 0) {
int orderkey_ = 0;
while (scanf("%d", &orderkey_) != EOF) {
try {
query *q = new query(orderkey_);
delete q;
} catch (FileException& f) {
f.print();
}
}
} else {
printf("Only orders can be queried!\n");
}
} else {
printf("Illegal command!\n");
}
return 0;
}