I am faceing a problem with printing hello and world on two diffrent lines!! What shoupd i do now? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I am faceing a problem with printing hello and world on two diffrent lines!! What shoupd i do now?

6th Dec 2016, 5:00 PM
Muhammad Umer
Muhammad Umer - avatar
4 Answers
+ 5
cout<<"Hello"<<endl<<"world"; there are other methods too
6th Dec 2016, 6:01 PM
Sandeep Chatterjee
+ 2
You can use '\n' or endle to break lines. These are known as escape sequence in C. Escape sequences are used in the programming languages C and C++, and also in many more languages (with some variations) like Java and C#. An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly. \n - Gives vertical tab (It moves you to the next line).
6th Dec 2016, 5:37 PM
Vipul Walia
Vipul Walia - avatar
+ 2
C: printf("hello \n world"); C++: cout<<"hello \n world";. or cout<<"hello"<<endl<<"world";
6th Dec 2016, 6:31 PM
Rajiv Puranik
Rajiv Puranik - avatar
+ 1
Yeah! Thanxx guyss
6th Dec 2016, 7:05 PM
Muhammad Umer
Muhammad Umer - avatar