{
cout<<HELLO WORLD"; //Display function printf() is used.
getch(); // help to come out from output screen.
}
- <iostream.h>= It is the library which contains standard input/output streams.
- cout = It is library function used to display text on the screen.
- getch()=The getch() function is used to catch a character from the keyboard. It is used to holds the output window until hitting any key from the keyboard.
DISPLAY using character variables
#include<conio.h>
void main()
{
char a,b.c,d,e,f,g; // Declaring variables
a = 'H'; // assigning values to the variables.
b = 'E';
c = 'L';
d = 'O';
e = 'W';
f = 'R':
g = 'D'; // assigning values to the variables.
cout<< a<< b<<c<<c<< d<e<<<d<< f<< c<<g; //Displaying the output
getch();
}
OUTPUT :
HELLOWORLD
DISPLAY using string (a character array).
#include<conio.h>
void main()
{
char s1[ ] = "HELLO WORLD\t";
char s2[] = {'H','e','l','l','o','w','o','r','l','d'}; //Declaration of variables and assigning value to them.
cout<< s1<<s2; //Displaying the output.
getch();
}
Output:
HELLO WORLD Helloworld
- \t = places the cursor 8 steps ahead.
- If you are using code blocks as your programming platform then it is must for you that after the preprocessor header line statement you need to add a line :
0 Comments
If you have any doubts , Please let me know.