-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
44 lines (35 loc) · 1.03 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
#include "shop.h"
namespace{
void print(Products list){
std::cout << "\nItems bought:\n";
for (auto &p : list){
std::cout << "item: " << p->name <<" price: "<< p->price << " quantity: " << p->quantity << std::endl;
}
}
}
int main(){
Supplier sup;
Shop tesco;
Customer arif;
tesco.printstock();
orderList ariforder1 = {{beans, 1}, {egg, 10}};
arif.shoppingList(ariforder1);
Products trolley;
trolley = arif.doShopping(tesco);
print(std::move(trolley));
orderList shopSupplies = {{beans, 1}, {egg, 1}, {milk, 1}, {bananas, 1}};
tesco.supplyList(shopSupplies);
tesco.buySupplies(sup);
tesco.printstock();
Products trolley2 ;
trolley2 = arif.doShopping(tesco);
print(std::move(trolley2));
tesco.printstock();
Products trolley3;
orderList ariforder2 = {{milk, 1}, {bananas, 3.5}};
arif.shoppingList(ariforder2);
trolley3 = arif.doShopping(tesco);
print(std::move(trolley3));
tesco.printstock();
return 0;
}