C++ Programming/Code/Variables/Examples/Adds two numbers and prints their sum1

From Wikibooks, open books for an open world
Jump to: navigation, search
// This program adds two numbers and prints their sum, variation 1
#include <iostream>
#include <ostream>
 
using namespace std;
 
int main()
{
  int a = 123, b (456), sum = a + b;
 
  cout << "The sum of " << a << " and " << b << " is " << sum << endl;
 
  return 0;
}