Don't show time elapsed screen if you quit.

This commit is contained in:
David Vereb 2020-03-10 16:15:13 -04:00
parent baca448ea2
commit c105ed13a0

View File

@ -66,12 +66,12 @@ int main(int argc, char *argv[])
// Keep track of time:
auto start_time = std::chrono::steady_clock::now();
unsigned int input = 'q';
while(selected != problems.end() && *selected)
{
Problem *current_problem = *selected;
current_problem->Draw(true, input_style); // refresh with new input
auto input = getch();
input = getch();
if(input == 'q') // early exit
break;
switch(input)
@ -106,6 +106,8 @@ int main(int argc, char *argv[])
current_problem->Draw(current_problem == *selected, input_style); // refresh with new input
}
if(input != 'q') // if you didn't quit
{
// Keep track of time:
auto end_time = std::chrono::steady_clock::now();
auto elapsed_time = std::chrono::duration_cast<std::chrono::seconds>(end_time - start_time);
@ -121,6 +123,7 @@ int main(int argc, char *argv[])
while(!(getch() == 'q'))
;
}
for(auto *problem : problems)
if(problem)