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;
}
@mbozzi - When someone points out a thread is a duplicate, please keep your comments to the original (linked) thread. Having comments in multiple threads is confusing and a waste of time.