0
Can you say where is a problem. It's a calculator
#include <iostream> using namespace std; float calc(int a, float c, float d){ switch(a) { case'+': cout << c+d; break; case'-': cout << c-d; break; case'*': cout << c*d; break; case'/': cout << c/d; break; } } void main() { cout << "Enter arithmetical action-,+,*,/"; float x,y; char o; cout << "Enter action"; cin << o: cin << x; cin << y; calc(o,x,y); }
2 Answers
+ 7
put whitespace after case before quote.