Parkmanne/main.cpp

55 lines
1.5 KiB
C++
Raw Normal View History

2019-05-28 16:46:55 +00:00
#include "headers/Park_spot.h"
#include <iostream>
#include <thread> // to make pausing work, not sure if i need chrono, or this, or both
#include <vector>
void Wait(int sec)
{
std::this_thread::sleep_for(seconds { sec });
}
using std::cout;
int main()
{
std::vector<Park_spot> spots {
1, 2, 3, 4, 5
};
std::vector<Customer> customers {
{ 1, "Sagar Ram", "eddgh" },
{ 2, "Shaq", "wsdfwefgv" },
{ 3, "Josh", "WDFGWEF" },
{ 4, "Stefano", "EDGGERG" }
};
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();
}