-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (31 loc) · 1.06 KB
/
main.cpp
File metadata and controls
33 lines (31 loc) · 1.06 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
#include <iostream>
#include <chrono>
#include "linear_diophantine_eq.hpp"
using namespace diophantine;
using namespace std::chrono;
int main() {
int a, b, c;
std::cout << "Please input values a, b and c separated by spaces:\n";
std::cin >> a >> b >> c;
std::cout << "Do you want to solve for:\n"
"[0] Non Negative numbers\n"
"[1] Positive numbers\n"
"[2] Negative numbers\n"
"[3] Non Positive numbers\n";
int solve_for;
std::cin >> solve_for;
auto start = steady_clock::now();
linear_diophantine_eq equation(a, b, c, SOLVE_FOR(solve_for));
auto solutions = equation.get_solutions();
auto end = steady_clock::now();
std::cout << "It took " << duration_cast<nanoseconds>(end - start).count() << " ns\n";
if (solutions.empty()) {
std::cout << "There are no solutions!\n";
} else {
std::cout << "The solutions are:\n";
for (const auto& solution : solutions) {
std::cout << solution << "\n";
}
}
return EXIT_SUCCESS;
}