0
I want to write a program, i want to computer do this: if (x>0) so show this message ; else show that message....but how?!
i've wrote it but as I run the program,both of messages are showing by computer😓
2 Antworten
+ 1
if(x > 0) cout << "this";
else cout << "that";
+ 1
Hi! Your code would be helpful...
General the if-else-construct in C++:
if (condition)
{ ... do something if true ...}
else
{ ... do something if false ...}
You can leave the curly brackets if there's only one code line in the blocks. I recommend to set them anytime.