0

What is wrong with the 2nd conditional?

this is the code: #include <iostream> #include <conio.h> using namespace std; int calcu(){ int entr1; cin >> entr1; if (entr1==1){ cout << "1" << endl; } if (entr1==2){ int num1,num2; char signo; cin >> num1 >> signo >> num2; if (signo=='+'){ cout << num1 + num2 << endl;} } if (entr1!=1&&entr1!=2){ cout << "nope" << endl; } return 0; } int main() { calcu(); return 0; } when you enter 2 in the program, it says no output, but I cant find anything wrong!

8th Jul 2016, 2:15 PM
ARPIKIHS
ARPIKIHS - avatar
1 Respuesta
+ 2
I wrote it and evething went OK. My inputs are 2 3 + 4 And the output is 7 This is quite right. Check out for syntax.
8th Jul 2016, 5:00 PM
Albert Gullbee