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😓

24th Nov 2016, 9:46 PM
Nahal
Nahal - avatar
2 ответов
+ 1
if(x > 0) cout << "this"; else cout << "that";
24th Nov 2016, 9:57 PM
Alexandru Toderică
Alexandru Toderică - avatar
+ 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.
24th Nov 2016, 10:01 PM
jotun263
jotun263 - avatar