Code:#include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> using namespace std; // prototype and name space declaration int sqr(int); int cube(int); int fourth(int); int fifth(int); bool printNum(); void show(int (*fn)(int), int); //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ void main() { while(printNum()) ; } //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ bool printNum() { char input; int block =0; cout<< "To Square Enter: S"<<endl; cout<< "To Cube Enter: C"<<endl; cout<< "To the Fourth Power Enter: F"<<endl; cout<< "To the Fifth Power Enter: H"<<endl; cout<< "To Quit: Q"<<endl; cin >> input; while ( input != 's' && input != 'S' && input != 'c' && input != 'C' && input != 'f' && input != 'F' && input != 'h' && input != 'H' && input != 'q' && input != 'Q') { cout << "Wrong Choice.\n"; cout << "Enter Again: "; cin.clear(); cin.ignore(80,'\n'); cin >> input; } if ( input == 'q' || input =='Q') { cout << "Program Ended. "<<endl; return 0; } while (true) { int lowVal ,maxVal; cout <<"Enter A Number For Low Bound: "; cin >> lowVal; cout <<"Enter A Number For Low Bound: "; cin >> Val; if ( input == 'q' || input =='Q') { cout << "Program Ended. "<<endl; return 0; } if ( (lowVal == 0 && maxVal == 0)) printNum(); cout <<"\n"; cout <<"Printing "<<(maxVal-lowVal)+1<<" numbers"<<endl; cout <<"\n"; for (int x = lowVal; lowVal<=maxVal; lowVal++) { switch (input) { case 's': { cout.setf(ios::left); cout<< setw(5); show(sqr, lowVal); block++; break; } case 'S': { cout.setf(ios::left); cout<< setw(5); show(sqr, lowVal); block++; break; } case 'c': { cout.setf(ios::left); cout<< setw(5); show(cube, lowVal); block++; break; } case 'C': { cout.setf(ios::left); cout<< setw(5); show(cube, lowVal); block++; break; } case 'f': { cout.setf(ios::left); cout<< setw(8); show(fourth, lowVal); block++; break; } case 'F': { cout.setf(ios::left); cout<< setw(8); show(fourth, lowVal); block++; break; } case 'h': { cout.setf(ios::left); cout<< setw(8); show(fifth, lowVal); block++; break; } case 'H': { cout.setf(ios::left); cout<< setw(8); show(fifth, lowVal); block++; break; } } if (block == 10) { block = 0; cout<<"\n"; } } cout <<"\n"; block = 0; } } //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ int sqr(int num) // list of functions { return num * num; } int cube(int num) // this one is to cube { return num * num * num; } int fourth(int num) { return num * num * num * num; } int fifth(int num) { return num * num * num * num * num; } void show(int (*fn)(int), int num) // pointer { cout << fn(num); }