@@ -21,9 +21,9 @@ std::vector<std::string> splittermathFinalValue(std::string& arg) {
2121 return myVec;
2222}
2323
24- int convertInt (std::string& n) {
24+ double convertInt (std::string& n) {
2525 try {
26- int v = std::stoi (n);
26+ double v = std::stod (n);
2727 return v;
2828 }
2929 catch (std::invalid_argument const & ex) {
@@ -33,11 +33,11 @@ int convertInt(std::string& n) {
3333 return 0 ;
3434}
3535
36- int mathFinalValue (std::string& content) {
36+ double mathFinalValue (std::string& content) {
3737 std::vector<std::string> vec = splittermathFinalValue (content);
3838
3939 int i = 0 ;
40- int finalValue = 0 ;
40+ double finalValue = 0 ;
4141
4242 for (auto const e : vec) {
4343 if (i == 0 ) {
@@ -51,8 +51,8 @@ int mathFinalValue(std::string& content) {
5151 std::string numberBefore = vec[i - 1 ];
5252 std::string numberAfter = vec[i + 1 ];
5353
54- int numberB = convertInt (numberBefore);
55- int numberA = convertInt (numberAfter);
54+ double numberB = convertInt (numberBefore);
55+ double numberA = convertInt (numberAfter);
5656
5757 if (finalValue == 0 ) {
5858 finalValue += numberB + numberA;
@@ -65,8 +65,8 @@ int mathFinalValue(std::string& content) {
6565 std::string numberBefore = vec[i - 1 ];
6666 std::string numberAfter = vec[i + 1 ];
6767
68- int numberB = convertInt (numberBefore);
69- int numberA = convertInt (numberAfter);
68+ double numberB = convertInt (numberBefore);
69+ double numberA = convertInt (numberAfter);
7070
7171 if (finalValue == 0 ) {
7272 finalValue -= numberA - numberB;
@@ -79,8 +79,8 @@ int mathFinalValue(std::string& content) {
7979 std::string numberBefore = vec[i - 1 ];
8080 std::string numberAfter = vec[i + 1 ];
8181
82- int numberB = convertInt (numberBefore);
83- int numberA = convertInt (numberAfter);
82+ double numberB = convertInt (numberBefore);
83+ double numberA = convertInt (numberAfter);
8484
8585 if (finalValue == 0 ) {
8686 finalValue = numberB * numberA;
@@ -93,8 +93,8 @@ int mathFinalValue(std::string& content) {
9393 std::string numberBefore = vec[i - 1 ];
9494 std::string numberAfter = vec[i + 1 ];
9595
96- int numberB = convertInt (numberBefore);
97- int numberA = convertInt (numberAfter);
96+ double numberB = convertInt (numberBefore);
97+ double numberA = convertInt (numberAfter);
9898
9999 if (finalValue == 0 ) {
100100 finalValue = numberB / numberA;
0 commit comments