0

How do I solve this code error?

#include <iostream> using namespace std; int main() { double a,b,c; cout<< "Enter the values for a:"; cin >> a; cout << "Enter the values for b:"; cin>> b; int operation; cout << "Enter the operation [+,-,* or /]:)"; cin >> operation; switch(operation) { case '+': c = a+b; break; case '-': c = a-b; break; case '*': c = a*b; break; case '/': c = a/b; break; } cout<< a << operation << b << "=" << c; return 0; }

2nd Dec 2018, 7:07 AM
Benjamin Law
Benjamin Law - avatar
1 Antwort
+ 7
int operation; --> char operation;
2nd Dec 2018, 7:29 AM
Babak
Babak - avatar