Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The C++ Picture App is here to draw color pictures for your enjoyment. We will be using the Windows Text Colors: Number Text Color Number

The C++ Picture App is here to draw color pictures for your enjoyment. We will be using the Windows Text Colors:

Number

Text Color

Number

Text Color

0

Black

8

Bright Black

1

Blue

9

Bright Blue

2

Green

10

Bright Green

3

Cyan

11

Bright Cyan

4

Red

12

Bright Red

5

Purple

13

Bright Purple

6

Yellow

14

Bright Yellow

7

White

15

Bright White

Write a C++ program that asks the user to select a color and a shape to draw.

In main, begin by declaring variables and displaying the class header, and cout an explanation of the program. You may include this in your header or make it separate.

You will need constants for the maximum color number and for the maximum picture number as well as a value that indicates the user has finished drawing.

These will look like:

//Constants

const int QUIT{ 6};

const int MAX_COLORS{ 6};

const int MAX_PIX{3};

At this point, create a handle to the standard output device (the console) using:

HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);

You will use this handle to access the screen to change colors. You will also need to #include .

Open a do-while loop. This is the play loop. Provide a menu of colors and ask the user to select a color for the drawing. There will be 6 menu items, 5 colors, blue, green, cyan, red and purple. These will be selections 1-5. Selection 6 is to quit the drawing loop.

Use a while loop to check to make sure that the users answer is in the correct range of value, 1 6. If it is not, loop back and ask the user to re-enter their choice.

As long as the selection is not 6, present another menu and ask the user to select the picture to be drawn. There will be 3 pictures, a 1) smiling face, 2) a pyramid and 3) a picture of your choice. Check the input validity of that selection using a do while loop.

Use a switch structure to process the picture selection. Declare any variables you will use in the drawings up above the switch statement.

In each case statement, set the color using:

SetConsoleTextAttribute(screen, colorChoice);

Be sure to adjust the colorChoice value so that you will be drawing with the bright version of the color. It shows up so much better! Each picture will be drawn using the color selected by the user. Each picture can be drawn using symbols of your choice.

When the user selects 6 for the color selection, drop out of the loop, and show a good-bye message.

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

Define promotion.

Answered: 1 week ago

Question

Write a note on transfer policy.

Answered: 1 week ago

Question

Discuss about training and development in India?

Answered: 1 week ago

Question

Explain the various techniques of training and development.

Answered: 1 week ago

Question

=+2. What different types of products exist in the book industry?

Answered: 1 week ago