-4
Follows code:
#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.
What is the doubt?
– user28595
was giving error, but I discovered that it was because I had forgotten to put the ; after the Break hehe
– Aprendiz