Hello, I am new to C++ and I was trying to write a simple calculator program that has a do-while loop and also includes a series of != statements. Even though I make the statements with all the appropriate keystrokes it keeps giving me my invalid sign statement. Also, I would like to know if I used the "while" statement properly. Thank you for your help in advance =D!
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int result,value;
char sign;
int main()
{
result = 0;
do
{
cout<< "Current value is "<<result<<endl;
cout<< "Please enter an operation +,-,*,/ <Press 'Q' to quit>"<<endl;
cin>> sign;
cout<< "Input value"<<endl;
cin>> value;
if ((sign != '+') || (sign != '-') || (sign != '*') || (sign != '/') || (sign != 'Q') || (sign != 'q'))
{
cout<<"Invalid sign "<<"("<<sign<<") used.";
}
else
{
if (sign == '+')
{
result += value;
}
else
{
if (sign == '-')
{
result *= value;
}
else
{
if (sign == '/')
{
result /= value;
}
}
}
}
}
while(sign != 'Q' || sign != 'q');
return 0;
}