-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfractal.cpp
More file actions
37 lines (31 loc) · 1.15 KB
/
fractal.cpp
File metadata and controls
37 lines (31 loc) · 1.15 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
#include <exception>
#include <iostream>
#include <string>
#include <cstdlib>
#include <mpfr.h>
#include "parser.h"
int main(int argc, const char** argv) {
try {
std::string executableName(argc > 0 ? argv[0] : "");
fractal::parser parser(executableName, std::cin);
std::string outputFile;
mpfr_t xCenter, yCenter, width;
unsigned int maxIters;
while (parser.get_params(outputFile, xCenter, yCenter, width, maxIters)) {
std::cerr << "outputFile = \"" << outputFile << "\"\n";
std::cerr << "xCenter = \"" << mpfr_get_d(xCenter, MPFR_RNDN) << "\"\n";
std::cerr << "yCenter = \"" << mpfr_get_d(yCenter, MPFR_RNDN) << "\"\n";
std::cerr << "width = \"" << mpfr_get_d(width, MPFR_RNDN) << "\"\n";
std::cerr << "maxIters = \"" << maxIters << "\"\n";
}
}
catch (std::exception& e) {
std::cerr << "An unhandled exception occurred: " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
std::cerr << "An unhandled exception occurred" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}