Hi. I'm having trouble making a simple calculator.
The code I have so far compiles, but it does not run.
Right now I only have addition in because I wanted to make sure I was going in the right direction before I added anything else.
I have to use a Do...while statement in this code.
Can anyone tell me when the program doesn't run???
Here is what I have so far:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
char sign;
string input;
string total=0;
cout << "Current total is 0" << endl;
do
{ cout << "Enter an operation: + - * / (or enter X to exit):";
cin >> sign;
if (sign = '+')
cout <<"Enter a number: ";
cin >> input;
cout <<"Current total is " << input + total;
}
while (input != "X");
}
Thanks in advance.