Answer to Question #173130 in C++ for Kyle

Question #173130

Do a C++ program using nested loops to create the following report:Prompt the user for number of rows and columns and create a table with the number of rows and columns that was given by the end user and repeat this process by asking the user if the user wants to continue. If the user says Y or y you’ll clear the screen and start all over again and if the user enters N or n you’ll stop the loop and output the “Thank you” note.


1
Expert's answer
2021-03-18T19:32:45-0400
#include <iostream>


using namespace std;


int main()
{
    int rows, columns;
    char answer;


    do{
        cout << "Enter number of rows: ";
        cin >> rows;


        cout << "Enter number of columns: ";
        cin >> columns;


        cout << endl << "\nYour table" << endl;


        for(int i = 1; i <= rows; i++)
        {
            for(int j = 1; j <= columns; j++)
                cout << "-" << " ";
            cout << endl;


        }


        cout << endl << endl << "Do you want to continue[Y/N]? ";
        cin >> answer;


    }while(answer=='Y');


    cout << "Thank you";
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
22.03.21, 02:00

Dear client, please use panel for submitting questions

maia
22.03.21, 01:58

How do you put the numbers in for the rows and columns?

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS