working test
This commit is contained in:
43
main.cpp
43
main.cpp
@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include <thread> // to make pausing work, not sure if i need chrono, or this, or both
|
||||
#include <vector>
|
||||
#include "thirdparty/SQLiteCpp/include/SQLiteCpp/SQLiteCpp.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -31,44 +32,12 @@ using std::cout;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<Park_spot> spots {
|
||||
1, 2, 3, 4, 5
|
||||
};
|
||||
std::vector<Customer> customers {
|
||||
{ 1, "Sagar Ram" },
|
||||
{ 2, "Shaq" },
|
||||
{ 3, "Josh" },
|
||||
{ 4, "Stefano" }
|
||||
};
|
||||
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
|
||||
|
||||
db.exec("create table Customer (id int primary key, name text, card_code varchar(20), verhicle int)");
|
||||
db.exec("create table Park_spot (id int primary key, taken boolean, customer_id int)");
|
||||
db.exec("create table Park_time (id int primary key, customer_id int, spot_id int, start real, end real, duration real)");
|
||||
|
||||
spots[1].clock(&customers[3]); // stefano parks at spot 2
|
||||
Wait(2);
|
||||
spots[3].clock(&customers[2]); // josh parks at spot 4
|
||||
Wait(1);
|
||||
spots[1].clock(&customers[3]); // stefano clocks out of spot 1
|
||||
Wait(5);
|
||||
spots[1].clock(&customers[1]); // shaq clocks in at spot 1
|
||||
Wait(6);
|
||||
spots[2].clock(&customers[0]); // sagar clocks in at spot 3. what the fuck is he doing here?
|
||||
Wait(2);
|
||||
spots[2].clock(&customers[0]); // sagar clocks out from spot 2
|
||||
Wait(3);
|
||||
spots[3].clock(&customers[2]); // josh clocks out from spot 4
|
||||
spots[1].clock(&customers[1]); // shaq clocks out at spot 1
|
||||
|
||||
spots[2].clock(&customers[1]); // shaq clocks out at spot 3
|
||||
Wait(4);
|
||||
spots[2].clock(&customers[1]); // shaq clocks out at spot 2
|
||||
|
||||
/*
|
||||
so:
|
||||
stefan parked for 3 secs
|
||||
josh parked for 17 secs
|
||||
shaq parked 2 times, once for 4 and another for 11 secs
|
||||
sagar parked for 2 secs
|
||||
*/
|
||||
customers[0].gen_monthly();
|
||||
customers[1].gen_monthly();
|
||||
customers[2].gen_monthly();
|
||||
customers[3].gen_monthly();
|
||||
}
|
Reference in New Issue
Block a user