Variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson


int a = 10; int b = a; cout<<“a+b”<<endl; // displays 20; why does there have to be an ‘endl’ since its a single statement. Is this alternative wrong?[ cout<<“a+b” ; ]

21st Sep 2019, 9:22 PM
Nicholas Amponsah
Nicholas Amponsah - avatar
4 Answers
+ 2
Nicholas Amponsah you just need to put the endl if you want the cursor to jump to the next line after printing the result.
21st Sep 2019, 9:53 PM
Ulisses Cruz
Ulisses Cruz - avatar
Ulisses Cruz thank you, i do know that. All I wanna know is does this coding necessarily have to be the one above
21st Sep 2019, 10:04 PM
Nicholas Amponsah
Nicholas Amponsah - avatar
Hi I wont , JS is fun ,this code
12th Jun 2021, 2:16 AM
Aloka Malinga
- 2
Hello am iranian and my language is parsian
8th Feb 2021, 9:47 PM
محمد ماهان ترکمان
محمد ماهان ترکمان - avatar