#include <iostream>
#include <cmath>
usingnamespace std;
//printTabs function to calculate and output table
void printTabs(int startValO, int rowO, int incrementO)
{
int answer;
for(int i = 1; i <= rowO ; i++)
//start loop to control rows
{
for(int j = 1; j <= 3; j++)
//loop to control columns
{
answer = pow(startValO, j);
//expression to calculate square and cube of starting value/incremented value with column j
cout << answer << '\t';
//out put of integer answer
}//End of row loop
startValO += incrementO;
// to increment the initial value
cout << endl;
}//End of row loop
}//End of printTabs
//selTabs to
void selTabs(int startValP, int rowP, int incrementP)
{
//if statement to set increment to 1 if a value of 0 or less us input
if(incrementP < 1)
incrementP = 1;
printTabs(startValP, rowP, incrementP);
}
//main function to call table from function printTabs
int main()
{
int startVal, rows, increment;
//user instructions and input
cout << "Enter starting value: ";
cin >> startVal;
cout << "Enter the number of values to be displayed: ";
cin >> rows;
cout << "Enter the increment between the values: ";
cin >> increment;
//display headings
cout << "NUMBER" << '\t' << "SQUARE" << '\t' << "CUBE" << endl;
//call and produce table from void function printTabs
selTabs(startVal, rows, increment);
return 0;
}
#2. As I said previously, you don't need seltabs() function. Also printtabs() can be simplified and the NUMBER column number taken out of the inner loop. Also, you don't need i.
If you look back at the original assignment in the first post, there was no prompt for the mailing address. (The user does not enter it.)
You can define a constant that contains the mailing address and skip the lines (lines 12 - 14) where you ask for the address and have the user enter it.