+ 1
Shouldn't there be a way to input information in the code so the *if* statement can go into effect?
I'm currently on the "else statement" lesson of c++ and I find it strange that the code does not ask me for input to run. Like, {int age= 18 if (age>4) {cout<<"Adult";} else{cout<<"Teenager";} If I don't input anything there's no use is there? Shouldn't there be var and cin things around there? Also, if somebody could explain why the bracket patterns seem so weird (I don't understand why they're ordered how they are. I see a huge mess) that'd be great.
3 Antworten
+ 7
Yes you need to use cin Anything you doubt?
0
It is just an example to demonstrated the concept, it isn't meant to be a real useful program.
0
Oh, so it's just an example then.. Thank you 😊