-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
53 lines (50 loc) · 1.55 KB
/
main.cpp
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
/*
John Berlin
*/
#include <iostream>
#include <string>
#include <exception>
#include "MatrixOperations.h"
#include "MenuSelections.h"
#include "MatrixMethods.h"
#include "Extra.h"
#include "Function.h"
#include "FunctionFactor.h"
#include "Roots.h"
#include "RootOperations.h"
int main(int argc, char **argv) {
std::string c;
bool goToMatSolver = false;
MatrixOperations matOp;
if(argc >= 2)
matOp.setFile(std::string(argv[1]));
RootOperations rOp;
while(true) {
if(goToMatSolver)
c = "m";
else {
mainMenu();
c = getInput();
}
if(c == "q") {
std::cout<<"\nThank you for using this program have a nice day"<<std::endl;
break;
} else if(c == "c" || c == "i" || c == "m"){
try{
goToMatSolver = matOp.operations(c);
}catch (std::exception& e){
std::cerr<<"An exception was thrown "<<e.what()<<std::endl;
std::cerr<<"It was non fatal you can try again(correct last input)\nOtherwise exit the program"<<std::endl;
}
}else if(c == "r"){
try{
rOp.operations();
}catch (std::exception& e){
std::cerr<<"An exception was thrown "<<e.what()<<std::endl;
std::cerr<<"It was non fatal you can try again(correct last input)\nOtherwise exit the program"<<std::endl;
}
}else
std::cout<<"\nThe input choice is not valid please try again"<<std::endl;
}
return 0;
}