diff options
Diffstat (limited to 'src/main.cpp')
-rwxr-xr-x | src/main.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp index 72e4df0..732d67a 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,7 +22,11 @@ along with this program. If not, see https://www.gnu.org/licenses/ #include "time.h" #include "test.h" -#define CLEAR "\033[2J\033[1;1H"; +#ifdef WIN32 + #define CLEAR std::system("cls") +#else + #define CLEAR std::cout << "\033[2J\033[1;1H" +#endif int main(int argc, char* argv[]) { @@ -54,7 +58,7 @@ int main(int argc, char* argv[]) long double social_costs = 1.26; while(1) { - std::cout << CLEAR; + CLEAR; std::cout << "\n------------- Setup and defaults -------------\n"; std::cout << "[d] Dayrate: " << dayrate << " (" << hourly_rate << " hourly)\n"; std::cout << "[w] Workdays to input: " << number_of_days << "\n"; @@ -102,10 +106,10 @@ int main(int argc, char* argv[]) } } setup_done: - std::cout << CLEAR; + CLEAR; //number_of_days = 1; // Just here for debugging - std::vector<workday> workdays; + workday workdays[number_of_days]; moment previous_wrap{0, 16, 20, 11, 1000}; // Set to a long time ago @@ -123,7 +127,7 @@ setup_done: moment lunch_end = lunch_start+(delta){30,0,0}; while(1) { - std::cout << CLEAR; + CLEAR; std::cout << "\n------------- DAY " << day+1 << " -------------\n"; std::cout << "[c] Calltime: " << timeprint(calltime) << "\n"; std::cout << "[w] Wraptime: " << timeprint(wraptime) << "\n"; @@ -166,28 +170,26 @@ setup_done: } done: - workdays.push_back({previous_wrap, + workdays[day] = {previous_wrap, calltime, wraptime, - planned_wraptime}); + planned_wraptime}; if(lunch_start != lunch_end) workdays[day].lunch(lunch_start, lunch_end); - workday* current_workday = &workdays[day]; + std::cout << "\nCalltime: " << timeprint(workdays[day].call) << "\n"; + std::cout << "Wraptime: " << timeprint(workdays[day].wrap) << "\n"; + std::cout << "Planned wrap: " << timeprint(workdays[day].planned_wrap) << "\n\n"; - std::cout << "\nCalltime: " << timeprint(current_workday->call) << "\n"; - std::cout << "Wraptime: " << timeprint(current_workday->wrap) << "\n"; - std::cout << "Planned wrap: " << timeprint(current_workday->planned_wrap) << "\n\n"; - - for(int i=0; i<current_workday->total_timeblocks; i++) { - std::cout << "Timeblock " << i << ": " << timeprint(current_workday->blocks[i]) - << ". Total hours: " << current_workday->blocks[i].hourcount() - << "\t Valuefactor: " << current_workday->blocks[i].valuefactor << std::endl; + for(int i=0; i<workdays[day].total_timeblocks; i++) { + std::cout << "Timeblock " << i << ": " << timeprint(workdays[day].blocks[i]) + << ". Total hours: " << workdays[day].blocks[i].hourcount() + << "\t Valuefactor: " << workdays[day].blocks[i].valuefactor << std::endl; } // This assumes that the user is entering things chronologically, which they may not be previous_wrap = wraptime; - std::cout << CLEAR; + CLEAR; } std::cout << "\n\n\n -+-+-+-+-+-+-+- CALCULATION -+-+-+-+-+-+-+-\n\n"; std::cout << "Dayrate: " << dayrate << "\n"; |