Question: How do I write a program in c++ that asks the user for a choice of pattern, and then a choice of size. It will

How do I write a program in c++ that asks the user for a choice of pattern, and then a choice of size. It will produce, on the screen, a square with the particular pattern of the given size?

It has to keep repeating until the user chooses to quit

There are 4 patterns to choose from:

a square with a left to right diagonal in which the diagonal is the size of the square

a square with a right to left diagonal in which the diagonal is the size of the square

a square that fills from left to right, using the size of the square as the fill character

a square that fills from right to left, using the size of the square as the fill character

If the user tries to make an invalid choice, the program should keep asking for a valid choice

There are 9 sizes to choose from: 1 9

If the user enters an invalid size, the program should keep asking until a valid size is entered

I must use a switch statement in the code for the pattern choice and

use a do-while loop to repeat the program for the user.

This is an example.

How do I write a program in c++ that asks the user

CWindows system321cmd.exe Your options are: 1: A square with a left to right diagonal 2: a square with a right to left diagonal 3: a square that fills left to right 4: a square that fills right to left 5: exit which choice? 2 Please pick a size, from 1 through 9: 6 ####6# ###6## ##6### #6#### Your options are: 1: A square with a left to right diagonal 2: a square with a right to left diagonal 3: a square that fills left to right 4: a square that fills right to left 5: exit which choice? 3 Please pick a size, from 1 through 9: 4 4### 44## 444# Your options are: 1: A square with a left to right diagonal 2: a square with a right to left diagonal 3: a square that fills left to right 4: a square that fills right to left 5: exit which choice?5 You chose to exit, goodbye! Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!