Now lets create another C++ program which asks the user to input two integers and dispays those integers.
Here, conio.h is included to enable the clrscr() function. It clears the screen from any text before executing the codes succeding it.
The getch(); function is used to get a character from the user (hey, you know what's character is, don't you? or else check out my first post : WHAT I NEED TO KNOW BEFORE I START).
We declared two variables- num1 and num2 of data type int. Then we used cout<< to display our appropriate message. After that we used cin>> to get the input from the user (cin stands for console input, and there are a lot of ways to accept input and display outputs like getline, printf etc.).
Then again we displayed the numbers the user input.
ANSWERS TO PREVIOUS POST Qs:
In C++, or in any other programming language, the codes are executed sequencially, i.e, the 1st line is executed first, then the 2nd line and so on. So, if you include iostream in the begining, the compiler gets all the finction definitions in iostream.h, before executing the main( ) function, where you're using cout. But if you include iostream in the end, the main() function will get executed first and as there will be no definition for cout, the compiler will display an error that the function cout must have a prototype.
The iostream. h contains commonly used pre-written functions and codes of about 600 lines. So, if are going to make even simple programs, you'll have to write hundereds of line. So, to make it easier for you, or me or for anyone, header files are aprovided along with the IDE and these header files are kept in the standard library functions.