Hi, I am new to C++ so this may seem like a stupid problem, but it has me stumped.
What I'm supposed to do here, is compare the value in mysign to +. Add if it is +, subtract if it is -, and display error message if it is neither.
this is what I have so far:
Code:
#include <iostream>
using namespace std;
main()
{
int first, second, result=0;
char mysign;
cout<<"Please input an integer. \n";
cin>> first;
cout<<"Please input an integer once again. \n";
cin>> second;
cout<<"Please input + or - \n";
cin>> mysign;
if (+ == mysign) ; {
cout<< first+second;
cin>> result;
}
else if(- == mysign) ; {
cout<< first-second;
cin>> result;
}
else ;{
cout<< "Cannot perform an operation.\n";
}
cout<<"The variable stored in result is:" << result << endl;
cin.get();
return 0;
}
There are probably many things wrong here, please help me correct them. I'm lost.