Question: I Tried to do this coding, next to the question Is my code. I don't know why the code doesn't work. Please help! How do

I Tried to do this coding, next to the question Is my code. I don't know why the code doesn't work. Please help! How do I get c++ to ignore the spaces. What am I doing wrong? I Tried to do this coding, next to the question Is myWe want to make a simple calculator that can add and subtract integers...code. I don't know why the code doesn't work. Please help! How

//We want to make a simple calculator that can add and //subtract inte//gers and will accept arbitrarily //long mathematical formula composed //of symbols +, -, and non-negative integer numbers. //100+5025+0+123-1 #include #include #include #include # include #include using namespace std; int main() { //sets sum to 0 int sum = 0; char ch = '+'; int operand; string formula; while (getline(cin, formula)) { if(ch { sum -= operand;} else if(ch '+'){ sum += operand;} else { sum -= operand;} } cout sum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!