+ 2

HELP ME SOLVE THIS ERRORS 😭

#include <iostream> #include <string> #include <cmath> using namespace std; void insert(string& exp, char num) { exp += num; } void opt(string& exp, char amd) { if (!exp.empty()) { exp += amd; } } void zero(string& exp) { if (!exp.empty()) { exp += '0'; } } void equal(string& exp) { if (!exp.empty()) { try { double result = eval(exp); cout << result << endl; } catch (exception& e) { cout << "Syntax Error!" << endl; exp = "Syntax Error!"; none(); } } if (exp == "0") { exp = ""; } if (exp == "Infinity") { cout << "Can't divide by Zero!" << endl; exp = "Can't divide by Zero!"; none(); } } void none() { cout << "Press the Clear button!" << endl; } void clean(string& exp) { exp = ""; } void back(string& exp) { if (!exp.empty()) { exp = exp.substr(0, exp.length() - 1); } } int main() { string exp = "";

12th Nov 2023, 9:31 AM
Programing Queen
Programing Queen - avatar
3 Respostas
+ 4
Share code link instead of writing with Question.
12th Nov 2023, 9:40 AM
A͢J
A͢J - avatar
+ 4
Haris Ibn Zahid , the issues with this code are: > the final closing curly brace `}` for the main function is missing. > most of the user functions insert(), opt(), zero(), ... are declared but never used. > function none() is called inside function equal(), which causes an error since none() can not be accessed. we can use forward declaration to avoid this. also the function eval() is called in function equal(), which also causes an error. as far as i know there is no eval() function in c++. >>> chek the error messages from the compiler helps you to fix the problem.
12th Nov 2023, 1:59 PM
Lothar
Lothar - avatar
13th Nov 2023, 2:48 PM
Imara Mohideen
Imara Mohideen - avatar