How to print a statement without using semicolon at the end of cout statement ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to print a statement without using semicolon at the end of cout statement ?

24th Feb 2017, 4:57 AM
Shaunak Pai Kane
Shaunak Pai Kane - avatar
8 Answers
+ 4
thanks...
24th Feb 2017, 5:32 AM
Shaunak Pai Kane
Shaunak Pai Kane - avatar
+ 3
if( cout<"your statement" ) { } You can use it in while loop to get a statement required number of times. Hope this helps!!
24th Feb 2017, 4:59 AM
G Hemanth
G Hemanth - avatar
+ 3
check my codes section I have written a code
27th Mar 2017, 12:46 PM
Shaunak Pai Kane
Shaunak Pai Kane - avatar
+ 3
just include cout statement in if loop u need not put semicolon in this case
27th Mar 2017, 12:49 PM
Shaunak Pai Kane
Shaunak Pai Kane - avatar
+ 3
So, if you print a statement in if statement semicolons will not be printed. Am I right?
27th Mar 2017, 12:54 PM
Vishnu ks
Vishnu ks - avatar
+ 3
it will cause error as u can't include semicolon in inside if loop condition
27th Mar 2017, 12:58 PM
Shaunak Pai Kane
Shaunak Pai Kane - avatar
+ 1
@G Hemanth Can you explain?
27th Mar 2017, 7:47 AM
Vishnu ks
Vishnu ks - avatar
0
int main(void) { if(printf("your statement")) { } } the above code works since printf returns number of characters it printed . you can use any function as a condition in if or in loops until they don't return void
26th Jun 2017, 3:42 PM
Umamaheswararao Tumma
Umamaheswararao Tumma - avatar