Follow the code below:
#include <iostream>
using namespace std;
int main()
{
float n1, n2;
int s;
float resul;
cout << "Digite um número para começar" << endl;
cin >> n1;
cout << "Vc quer (1)somar (2)diminuir (3)mutiplicar (4)dividir" << endl;
cin >> s;
switch (s) {
case 1:
cout << "Com qual valor?" << endl;
cin >> n2;
resul = n1 + n2;
break case 2 : cout << "Com qual valor?" << endl;
cin >> n2;
resul = n1 - n2;
break case 3 : cout << "Com qual valor?" << endl;
cin >> n2;
resul = n1 * n2;
break case 4 : cout << "Com qual valor?" << endl;
cin >> n2;
resul = n1 / n2;
break default : cout << "Error 404" << endl;
}
cout << "O resultado é " << resul << endl;
return 0;
}
Where did I go wrong? It's a simple calculator.