How do I Ask the user if they would like to enter two more integers (i.e. run the program again): repeat if yes, quit if no.
this is what I have
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int i,j;
int rval, cval;
do {
cout << "Enter the number of rows: ";
cin >> rval;
if(rval > 10 || rval < 0)
{ cout << "ERROR, # cannot be > 10 or < 0." << endl;}
} while (rval > 10 || rval < 0);
do {
cout << "Enter the number of columns: ";
cin >> cval;
if(cval > 10 || cval < 0)
{ cout << "ERROR, # cannot be > 10 or < 0." << endl;}
} while (cval > 10 || cval < 0);
cout << " * ";
for(i=0; i <= cval; i++)
{
cout << setw(2) << i << " ";
}
cout << endl;
for(i=0; i <= rval; i++)
{
cout << setw(2) << i << " ";
}
cout << endl;
for(i=0; i <= rval; i++)
{
cout << setw(2) << i << " ";
for(j=0; j <= cval; j++)
{
cout << setw(2) << i * j << " ";
}
cout << endl;
}
return 0;
}