C++ for statement loop initialization, condition, and altering statements
#include <iostream> #include <iomanip> using namespace std; int main()//from ww w . j av a2 s. co m { int num, final; cout << "Enter the final number for the table: "; cin >> final; cout << "NUMBER SQUARE CUBE\n"; cout << "------ ------ ----\n"; for (num = 1; num <= final; num++) cout << setw(3) << num << setw(8) << num * num << setw(7) << num * num * num << endl; return 0; }