My question is how can i implement code into this that uses a GetOperator() and a GetOperand() function to call into my main function to see if its bad input or not? This is what i have so far....
#include<iostream>
#include<string>
usingnamespace std;
int main()
{
float total, num;
char operat;
total=0;
do
{
cout<<"Please input your expression starting with an operand and type in '=' when completed ";
cin>>num;
if(operat=='-')
{
total=total-num;
}
else
{
total=total+num;
}
cout<<"Please insert a minus or addition operator ";
cin>>operat;
}while(operat!='=');
cout<<total;
return 0;
}
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.