-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
71 lines (56 loc) · 2.13 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "spreadsheet.hpp"
#include "select.hpp"
#include "select_contains.h"
#include "Select_Not.h"
#include "Select_And.h"
#include "Select_Or.h"
#include <iostream>
int main(int argc, char* argv[])
{
Spreadsheet sheet;
sheet.set_column_names({"First","Last","Age","Major"});
sheet.add_row({"Amanda","Andrews","22","business"});
sheet.add_row({"Brian","Becker","21","computer science"});
sheet.add_row({"Carol","Conners","21","computer science"});
sheet.add_row({"Joe","Jackson","21","mathematics"});
sheet.add_row({"Sarah","Summers","21","computer science"});
sheet.add_row({"Diane","Dole","20","computer engineering"});
sheet.add_row({"David","Dole","22","electrical engineering"});
sheet.add_row({"Dominick","Dole","22","communications"});
sheet.add_row({"George","Genius","9","astrophysics"});
sheet.print_selection(std::cout);
std::cout << std::endl;
// Sample usage 1
sheet.set_selection(new Select_Contains(&sheet, "Last", "Dole"));
sheet.print_selection(std::cout);
std::cout << std::endl;
// Custom sample usages
//sheet.set_selection( new Select_And(
//new Select_Contains(&sheet, "Major", "computer science"),
//new Select_Contains(&sheet, "Major", "computer science")
//));
//sheet.set_selection( new Select_Or(
//new Select_Contains(&sheet, "Last", "Becker"),
//new Select_Contains(&sheet, "Last", "Conners")
//));
//sheet.print_selection(std::cout);
//std::cout << std::endl;
// Sample usage 2
sheet.set_selection(
new Select_And(
new Select_Contains(&sheet,"Last","Dole"),
new Select_Not(
new Select_Contains(&sheet,"First","v"))));
sheet.print_selection(std::cout);
std::cout << std::endl;
// Sample usage 3
sheet.set_selection(
new Select_Or(
new Select_Contains(&sheet,"First","Amanda"),
new Select_Or(
new Select_Contains(&sheet,"Last","on"),
new Select_Contains(&sheet,"Age","9"))));
sheet.print_selection(std::cout);
std::cout << std::endl;
return 0;
}