Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify Lab 5 Program.cpp to create a program that asks the user for a positive integer value. The program will output a rectangle with that

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Modify Lab 5 Program.cpp to create a program that asks the user for a positive integer value. The program will output a rectangle with that many rows. You will also ask the user for another integer number. Row numbers that are evenly divisible by this number should be printed with a *. All other rows will print with a #. The program should use a for loop to print the ASCII art. Each row will have 10 characters. Your output needs to be formatted as shown below. Your program should only accept numbers 1 - 25. In other words, you cannot print more than 25 rows and the multiple should also be in this range. Sample run 1: Enter the number of rows you would like to print (1-25): 12 Enter the multiple: 2 ########## ########## ******** ########## ########## ########## ########## Sample run 2: Enter the number of rows you would like to print (1-25): 7 Enter the multiple: 3 ########## ########## ########## ########## ***** ########## Sample run 3: Enter the number of rows you would like to print (1-25): 30 Enter the multiple: 2 ERROR: number of rows and multiple should be in the range 1-25 Attach your modified .cpp file as your submission to this question. #include using namespace std; int main() { int rows, multiple; // Prompt the user for the number of rows and the multiple: cout > rows; cout > multiple; // TODO: Validate input, then print the sequence: return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

8. Do the organizations fringe benefits reflect diversity?

Answered: 1 week ago