Basic C++ calculator
I'm quite new to C++. This is what I'm disposing with at the moment and I
suppose you can guess the logic I'm trying to apply to the program so that
it may work. I need the user to supply an arithmetic to be performed and
if it's a certain one to add the numbers together. Here is the code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int x;
int v;
int sum;
string input;
cout << "Choose arithmetic: addition or subtraction? " << endl;
cin >> input;
if(input=='Addition'||input=='addition')
{
int first;
int second;
int sum = first+second;
cout << "Enter the first number: " << endl;
cout << "Enter the second number: " << endl;
cout << "The sum of these numbers is: " << sum << endl;
}
return 0;
}
The compiler gives me the following error: 13 error: no match for
'operator==' in 'input == 1953066862'
Thank you in advance!
No comments:
Post a Comment