Program to print “Hello” in C++.

In this program we know how print “Hello” in different ways by using different

methods in c++.

 

 

 

Let’s write these programs to Display “Hello” on Screen.

 

Step 1: Let’s open turboC++ and write the following code:

 

// Code:

 

#include<iostream.h>

#include<conio.h>

void main()

{

int i;

clrscr();

while(i<=10)

{

cout<<”HELLO \n ”;

i++;

}

getch();

}

 

 

 

Step 2: Run the program to see Output.

 

 

 

Output:

 

 

output

 

 

 

 

                                                                          OR

 

 

 

we can also print the name on Screen by using following Code:

 

 

//Code:

 

#include<iostream.h>

#include<conio.h>

#include<string.h>

void main()

{

char a[30];

clrscr();

cout<<”please enter your name: \n”;

cin>>a;

cout<<”your name is :\n “<<a;

getch();

}

 

 

Now , Run the program and see output.

 

Output:

 

 

output

 

Happy coding.

Tags: , , ,