Today's Task is that i have to teach you cin object of iostream.
Cin is an object. It is one of the members of iostream family, and iostream is a header file.
#include<iostream.h> // header file
#include<conio.h> // header file
void main() // main function
{ // Opening brackets of main function
clrscr(); /* clrscr function is used to clear the screen and it is good habit for programmers to use that function in the start of every program.*/
int var; // Variable Declaration
cout<< " Enter the Value of var: "; /* cout is use to print something in on the screen. In this line we simply print Enter the Value of var: on the screen. */
cin>> var ; /* In this line cin is used the functionality of cin ( Console Input ) is to input some value from the user and store it in the variable which is given. */
getch(); /* this function is used to get character from the user. The purpose of this function at that place is only that we want to stop the execution and see the result of the program. If you donot use that function when you run the program it may only blink and do not show any result. */
} // Closing brackets of main function
In this program I try to teach you cin of a C++ and how a cin works. I use cout and cin in this program.
Now your task is to read this post very carefully and practice it on your on pc.
InshAllah Next I will try to teach All of you the new Functions of C++ .
0 comments:
Post a Comment