home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0201.CPP
- // This is a simple C++ program to input 2 numbers,
- // add them together and print out the sum.
- #include <iostream.h> // Needed for cin and cout
-
- void main()
- {
- int a, b; // Input variables
- cout << "Please enter two integers" << endl;
- // Prompt for numbers
- cin >> a >> b; // Get the numbers
- int d = a + b; // Calculate the sum
- cout << "Here is the sum of your two integers: " << d << endl;
- // Print result
- }
-
-