Files
Project-Euler/Main.h

23 lines
745 B
C++

#include <iostream>
#include <chrono>
#include "Exercises.h"
int main()
{
while (true) {
// Input
char input;
cout << "Check(c), test(t) or quit(q) -> ";
cin >> input;
cout << endl;
// action
auto t1 = std::chrono::high_resolution_clock::now();
if (input == 'c') cout << "check result: " << Ex3(13195) << endl;
else if (input == 't') cout << "test result: " << Ex3(600851475143) << endl;
else if (input == 'q') break;
auto t2 = std::chrono::high_resolution_clock::now();
auto duration_ns = std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count();
cout << "Duration = " << duration_ns << " microseconds" << endl;
}
}