-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectEuler.cpp
More file actions
83 lines (76 loc) · 2.51 KB
/
Copy pathProjectEuler.cpp
File metadata and controls
83 lines (76 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "ProjectEuler.h"
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "ChallengeFive.h"
#include "ChallengeSix.h"
#include "ChallengeSeven.h"
void ChallengeSelect(int challengeType) {
switch (challengeType) {
case 1: {
// start challenge one
break;
} case 2: {
// start challenge two
break;
} case 3: {
// start challenge three
break;
} case 4: {
// start challenge four
break;
} case 5: {
int num;
std::cout << "Please enter the number: ";
std::cin >> num;
std::cout << std::endl;
// Start the clock after user input
unsigned long startTime = clock();
ChallengeFive cf(num);
cf.run();
float total_time = static_cast<float>(clock() - startTime) / 1000;
std::cout << "Calculation Took: " << total_time << " second(s)" << std::endl;
break;
} case 6: {
int num;
std::cout << "Please enter the number: ";
std::cin >> num;
std::cout << std::endl;
// Start the clock after user input
unsigned long startTime = clock();
ChallengeSix cs(num);
cs.run();
float total_time = static_cast<float>(clock() - startTime) / 1000;
std::cout << "Calculation Took: " << total_time << " second(s)" << std::endl;
break;
} case 7: {
int num;
std::cout << "Please enter the number: ";
std::cin >> num;
std::cout << std::endl;
// Start the clock after user input
unsigned long startTime = clock();
ChallengeSeven cs(num);
cs.run();
float total_time = static_cast<float>(clock() - startTime) / 1000;
std::cout << "Calculation Took: " << total_time << " second(s)" << std::endl;
break;
} default: {
std::cout << "Challenge does not yet exist." << std::endl;
break;
}
}
}
int main() {
std::cout << "Welcome to the Project Euler Solver!" << std::endl;
std::cout << "To solve a problem please insert the challenge number (1-6)." << std::endl;
std::cout << "Challenge Number: ";
int challengeNumber;
std::cin >> challengeNumber;
ChallengeSelect(challengeNumber);
system("PAUSE");
return 0;
}