+ 1
When I input 2 it prints human and not human. Should just print human. Tried to get rid of the else statement , it didn't work.
4 odpowiedzi
+ 9
I think that's what you want
#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
if(a == 2)
cout << "human" << endl;
else if(a <= 1)
cout << "sorry for your loss" << endl;
else {
cout << "not human" << endl;
if (a >= 5)
cout << "what are you" << endl;
}
return 0;
}
+ 9
Welcome, well keep practicing and you'll master it one day.
Everything looks hard at the beginning :)
+ 4
You have forgotten your curlies.
Like this, only one statement belongs to your first if, and the second if and the else belong together.
Or wait, you want three options, right?
Then you can change the second if to 'else if'.
+ 3
thank you, I don't know why this was so hard for me. It works now