C++ examples for Data Type:Introduction
Displaying sum's contents after each addition.
#include <iostream> using namespace std; int main()/*from w ww . j ava 2s . co m*/ { int sum; sum = 0; cout << "The value of sum is initially set to " << sum << endl; sum = sum + 96; cout << " sum is now " << sum << endl; sum = sum + 70; cout << " sum is now " << sum << endl; sum = sum + 85; cout << " sum is now " << sum << endl; sum = sum + 60; cout << " The final sum is " << sum << endl; return 0; }