+ 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
2 Réponses
+ 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. :>
+ 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