Any other way | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Any other way

is there any other way to get the output as hello world or the way is only one which is given

20th Dec 2016, 9:27 AM
Shivanshu Tiwari
Shivanshu Tiwari - avatar
2 Answers
+ 6
There are actually tons of ways to get the output "Hello World". The simplest way would be: std::cout << "Hello World"; You may also like to store "Hello World" inside a string and print the string using cout: string str = "Hello World"; std::cout << str; Other ways would even involve storing "Hello World" inside a character array of size 11 and print the arrays one by one using a loop. As you advance in C++, you will discover all different ways to suit your style and needs for different printing purposes. :>
20th Dec 2016, 9:50 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
depends on ur imagination and lots of ways use string directly use character array and print character by character using loop use pointers and address variables to print in fact it ll be easier to see it work check out my code on" 9 ways to print hello world" it ll be very helpful , with added comments
20th Dec 2016, 9:52 AM
Morpheus
Morpheus - avatar