From 78adbe39f0ce7b1e5a4925b4ba46165b90906231 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Thu, 4 Aug 2022 11:15:32 +0200 Subject: Much more beautiful formatting --- src/main.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 02037b8..d1c9080 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,8 +59,6 @@ int main(int argc, char* argv[]) for(int day=0; day> input_number; std::cin.ignore(); + std::cout << "\n"; switch (input_number) { case 0: goto done; @@ -114,15 +114,6 @@ int main(int argc, char* argv[]) } done: - //std::cout << "\nWraptime:\n"; - //moment wraptime = timeinput(calltime); - //std::cout << "\nPlanned wraptime:\n"; - //moment planned_wraptime = timeinput(calltime); - //std::cout << "\nLunch start:\n"; - //moment lunch_start = timeinput(calltime); - //std::cout << "\nLunch end:\n"; - //moment lunch_end = timeinput(calltime); - workdays.push_back({previous_wrap, calltime, wraptime, @@ -141,22 +132,28 @@ done: << ". Total hours: " << current_workday->blocks[i].hourcount() << "\t Valuefactor: " << current_workday->blocks[i].valuefactor << std::endl; } + + // This assumes that the user is entering things chronologically, which they may not be previous_wrap = wraptime; + std::cout << "\033[2J\033[1;1H"; } + std::cout << "\n\n\n -+-+-+-+-+-+-+- CALCULATION -+-+-+-+-+-+-+-\n\n"; + std::cout << "Dayrate: " << dayrate << "\n"; + std::cout << "Hourly rate: " << hourly_rate << "\n"; double total_sum = 0; for(int ii=0; ii < number_of_days; ii++) { workday& each_day = workdays[ii]; double day_price = 0; - std::cout << "\n ----- Day " << ii+1 << " ----- " << "\n"; + std::cout << "\n ----- Day " << ii+1 << ": " << timeprint(each_day.call, false) << " ----- " << "\n"; for(int jj=0; jj < each_day.total_timeblocks; jj++) { timeblock& each_block = each_day.blocks[jj]; double block_price = each_block.hourcount() * hourly_rate * each_block.valuefactor; - std::cout << "Price of block " << jj << ": " << block_price << "\n"; + std::cout << timeprint(each_block, true) << ", " << each_block.hourcount() << "h\t+" << (each_block.valuefactor-1)*100 << "%\t= " << block_price << "\n"; day_price += block_price; } - std::cout << "Price of day " << ii+1 << ": " << day_price << "\n"; + std::cout << "Price of day " << ii+1 << ": " << day_price << std::endl; total_sum += day_price; } -- cgit v1.2.1