You are asked to write a program which draws a house with a roof based on the following specifications (Using C++). Application name: Display a welcome banner A) Welcome user: Ask the user for their name and using their name welcome them to your application. B) Request house dimensions and validate input: Ask the user to enter the width and height of the house to be drawn (Note: Both height and width are integer). The width must be even and bigger than 2. If the user enters odd numbers or a number less than or equal to 2 for the width, you are required to prompt the user until they enter an even number. They have 3 tries for entering width. If after 3 tries they are still entering odd numbers terminate your program with an appropriate personalized message otherwise move on to step C. C) Draw the house:
3) You are asked to write a
Application name: Display a welcome banner
A) Welcome user: Ask the user for their name and using their name welcome them to your application.
B) Request house dimensions and validate input: Ask the user to enter the width and height of the house to be drawn (Note: Both height and width are integer). The width must be even and bigger than 2. If the user enters odd numbers or a number less than or equal to 2 for the width, you are required to prompt the user until they enter an even number. They have 3 tries for entering width. If after 3 tries they are still entering odd numbers terminate your program with an appropriate personalized message otherwise move on to step C.
C) Draw the house:
i.The roof consists of a set of stars on each row. Number of stars in the last row of the roof is equal to the width of the house. The first row starts with two stars and you increase the number of starts in the next row bye 2 and repeat this process until you reach to the width. For example, if the width is 6, the roof shape will be like this (2,4and 6 stars).
Hint: The number of rows needed to print/draw the roof is half the width of the house.
Note: There is no space between the stars in each row.
The body of the house has height+1 rows in all.
Last row are drawn using the dash character (‐). There are width dashes.
The walls are represented by height rows. Each of the rows are made up of 2 characters of | in the left and right sides and the rest are spaces. Keep track of the number of houses you have drawn.
D) Again? Ask the user if they wish you to draw another house. If yes repeat steps C. If no,move on to step E.
E) End program: display this message: “Hope you like your house(s)”
PS: Here are a few sample outputs: user input is highlighted in grey
Step by step
Solved in 3 steps with 2 images