/****************************************************** ** Name: ** Filename: tableloops.cpp ** Project #: Deitel & Deitel 2.21 ** Project Description: Write a program that utilizes looping and the tab escape sequence \t to print the following table of values: N 10*N 100*N 1000*N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 ** Output: N 10*N 100*N 1000*N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 ** Input: None ** Algorithm: Create a variable n and make it = to 1 Use looping and state while n >= 5 Print n, n*10, n*100, n*1000 for ever value of n up to 5 using the ++ preincrement operator End program ******************************************************/ // Include files #include // used for cin, cout #include using namespace std; // Global Type Declarations // Function Prototypes void instruct (void); void pause (); //Global Variables - should not be used without good reason. int main () { // Declaration section int n; // Executable section instruct (); cout << "N\t10*N\t100*N\t1000*N\n\n"; n = 1; while ( n <= 5 ) { cout << n << "\t" << n * 10 << "\t" << n * 100 << "\t" << n * 1000 << endl; ++n; } pause (); return 0; } void instruct (void) { // Declaration section // Executable section } void pause () { // Declaration section // Executable section cout << "\nPress any key to continue..."; getch(); cout << "\r"; cout << " "; cout << "\r"; } /* Program Output N 10*N 100*N 1000*N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 Press any key to continue... */