// multiplicationTable2.cpp
// Displays a multiplication table.
// Demonstrates nested loops.
// Uses addition to generate values within table.
#include <iomanip>
#include <iostream>
int main()
{
// Print headings of table:
cout << " |";
for ( int column = 1; column <= 12; column++ )
cout << setw(5) << column;
cout << endl;
cout << " -------+";
for ( int i = 1; i <= 62; i++ )
cout << "-";
cout << endl;
// Print body of table:
for ( int row = 1; row <= 12; row++ )
{
cout << setw(7) << row << " |";
int product = 0;
for ( int column = 1; column <= 12; column++ )
{
product = product + row;
cout << setw(5) << product;
} // for column
cout << endl;
} // for row
return 0;
} // function main