```
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
using namespace std; // prototype and name space declaration
int sqr(int);
int cube(int);
int fourthPower(int);
int fifthPower(int);
int sixthPower(int);
bool printNum();
void show(int (*fn)(int), int);
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
void main()
{
char first[30], last[30];
cout << "Please Enter Your First Name: ";
cin >> first;
cout << "\n";
cout << "Please Enter Your Last Name: ";
cin >> last;
cout << "\n\nThank you " << first << " " << last;
cout << "\n";
cout << "First choose a power and then "
<< "Enter the Bound limits "<<endl;
cout <<"Upper Bound And Lower Bound "
<<"need to be range of 0 and 100"<<endl;
cout << "Begins Excerise";
cout << "\n\n";
printNum();
}
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
bool printNum()
{
char input;
int block =0;
cout<< "To Square The Number Enter: S"<<endl;
cout<< "To Cube The Number Enter: C"<<endl;
cout<< "To the Fourth Power of The Number Enter: F"<<endl;
cout<< "To the Fifth Power of The Number Enter: T"<<endl;
cout<< "To the Sixth Power of The Number Enter: X"<<endl;
cout<< "To Quit: Q"<<endl;
cin >> input;
while ( input!= int('s') || input !=int('S')
|| input != int('c') || input !=int('C')
|| input != int('f') || input !=int('F')
|| input != int('t') || input !=int('T')
|| input != int('x') || input !=int('X')
|| input != int('q') || input !=int('Q'))
{
if ( input == int('q') || input ==int('Q'))
{
cout << "Program Ended. "<<endl;
return 0;
}
cout << "Wrong Choice.\n";
cout << "Enter Again: ";
cin.clear();
cin.ignore(80,'\n');
cin >> input;
}
while (true)
{
int lowVal ,maxVal;
cout <<"Enter A Number For Low Bound: ";
cin >> lowVal;
while ( !cin.good() ||( lowVal < 0 || lowVal >100 )) // validation
{
cout << "Positive Numbers Only.\n";
cout << "Enter Again: ";
cin.clear();
cin.ignore(80,'\n');
cin >> lowVal;
}
cout << "Enter A Number For Upper Bound : ";
cin >> maxVal;
while ( !cin.good() || maxVal < lowVal || maxVal >100 )
{
cout << "Positive Numbers Only.\n";
cout << "Upper Bound Can' Be Smaller Than Lower Bound";
cout << "Enter Again: ";
cin.clear();
cin.ignore(80,'\n');
cin >> maxVal;
}
if ( (lowVal == 0 && maxVal == 0))
printNum();
cout <<"Printing "<<(maxVal-lowVal)+1<<" numbers"<<endl;
for (int x = lowVal; lowVal<=maxVal; lowVal++)
{
if (input == int('s') || input == int('S'))
{
cout.setf(ios::left);
cout<< setw(5);
show(sqr, lowVal);
block++;
}
else if (input == int('c') || input == int('C'))
{
cout.setf(ios::right);
cout<< setw(5);
show(cube, lowVal);
block++;
}
else if (input == int('f') || input == int ('F'))
{
cout.setf(ios::right);
cout<< setw(8);
show(fourthPower, lowVal);
block++;
}
else if (input == int('t') || input == int ('T'))
{
cout.setf(ios::right);
cout<< setw(10);
show(fifthPower, lowVal);
block++;
}
else if (input == int('x') || input == int ('X'))
{
cout.setf(ios::right);
cout<< setw(10);
show(sixthPower, lowVal);
block++;
}
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 fourthPower(int num)
{
return num * num * num * num;
}
int fifthPower(int num)
{
return num * num * num * num * num;
}
int sixthPower(int num)
{
return num * num * num * num * num * num;
}
void show(int (*fn)(int), int num) // pointer
{
cout << fn(num);
}
```

first of all i want to thank you all for help me on the other thread.

after reading all the comments, i realized that i am shouldn't be posting a different question

on a same thread so i am posting this question on a new thread.

1)i am offering user 6 options, s,S,c,C...q and Q

if user inputs s for square and then the program will prompt user to input 2 number one for upper and one for lower bound.

afterward i will display all the number in between the boundary and square all the numbers

and prints them.

after the print it will ask the user again for a new sets of boundary and if the user inputs 2 0's. my program will bring up the original prompt and start fresh again.

2)the loop i set i want it to catch the user input if they enter anything other than s,S,c,C..q and Q. i will display a error message and ask for input again.

3)i entered this

input output

2 wrong input

a wrong input

s wrong input

q quit

4)when i enter q the i am surprise program ends, but when i enter s or any of the characters in the option i offer my loop will keep re promote for another input why.

thanks