This time I would like to write how to show variable in the program.
To show letter is using cout<< " "; and the letter is put between " ".
To show variable is using cout<<
Just see the example below:
#include “iostream.h”
#include “conio.h”
Main()
{
int x;
x=6;
cout<< ”The variable is:”; cout<< x;
getch();
}
The result is like the picture below
int is a type of variable for integer number variable.
x is a name of variable. We can make any name of variable.
x=6 means that we give a value to the variable with 6.
So, by cout<< x; will be shown or print 6 on the screen.
Try to change x variable with any number for example x=25, or any number else.
It would be seen the difference.
Good luck.
0 comments:
Post a Comment