Write a condition in if statement to get output as "HELLOWORLD" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a condition in if statement to get output as "HELLOWORLD"

if(_____) { cout<<"HELLO"; } else { cout<<"WORLD"; }

28th Oct 2016, 2:55 AM
Ashik Paul Eldo
Ashik Paul Eldo - avatar
4 Answers
+ 1
using this syntax, you will not be able to output both conditions, since it will run only one of the two then finish. For example if the condition was if (true), it would ONLY run HELLO. You could put it into a loop like this: bool foo = true; while (true) { if (foo) cout << "HELLO"; else { cout << "WORLD"; break; }
29th Oct 2016, 3:19 AM
Zeke Williams
Zeke Williams - avatar
+ 1
Oh, you already know your own question. Well, I have no idea then. I give up
1st Nov 2016, 2:09 AM
Zeke Williams
Zeke Williams - avatar
0
no there is a way out... try harder😝
29th Oct 2016, 3:18 PM
Ashik Paul Eldo
Ashik Paul Eldo - avatar
0
no...wrong answer you just need to give a condition to if statement
27th Dec 2016, 9:32 AM
Ashik Paul Eldo
Ashik Paul Eldo - avatar