How do I use "if" for taking user inputs? (C++) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I use "if" for taking user inputs? (C++)

Help c++

6th Mar 2022, 3:50 AM
Sonic_gameryt6 _
3 Answers
+ 1
Simba I have 11 dollars And I want to buy a house that cost 1000$ But if I put the input "house" it says I get in debt But if I have more than 1000$, I buy it👍
6th Mar 2022, 3:59 AM
Sonic_gameryt6 _
+ 1
Yeah, that's how an if-else statement works. You can take house as input variable and use it with relational operators(< or >) in if condition.
6th Mar 2022, 4:26 AM
Simba
Simba - avatar
+ 1
Manav Roy thanks!
6th Mar 2022, 6:27 AM
Sonic_gameryt6 _