Using Input Output a little

C++ does not directly define any statements to do input or output (IO). Instead, IO is provided by the standard library. The IO library provides an extensive set of facilities.
 

Standard Input and Output Objects

The library defines four IO objects. To handle input, we use an object of type istream named cin. This object is also referred to as the standard input. For output, we use an ostream object named cout. It is often referred to as the standard output. The library also defines two other ostream objects, named cerr and clog. The cerr object, referred to as the standard error, is typically used to generate warning and error messages to users of our programs. The clog object is used for general information about the execution of the program.
 
Ordinarily, the system associates each of these objects with the window in which the program is executed. So, when we read from cin, data is read from the window in which the program is executing, and when we write to cout, cerr, or clog, the output is written to the same window. Most operating systems give us a way of redirecting the input or output streams when we run a program. Using redirection we can associate these streams with files of our choosing.

Example

#include <iostream>
#include <stdlib.h>
int main()
{
    std::cout << "Enter two numbers:" << std::endl;
    int v1, v2;
    std::cin >> v1 >> v2;
    std::cout << "The sum of " << v1 << " and " << v2
              << " is " << v1 + v2 << std::endl;
    getchar();
    return 0;

}