Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With a magnifying glass, one can see characters on a computer screen are made from many small dots or pixels. Code was written to draw

With a magnifying glass, one can see characters on a computer screen are made from many small dots or pixels. Code was written to draw those pixels. You will write code to simulate drawing pixels needed for three character shapes. You earn 10 points for one arrow character, and 5 points each for two letter characters, 20 points total.

The height of the shape can vary. Your code should draw each shape as tall as the user requests.The number of lines displayed for the shape should be exactly the number of lines requested - not less, not more.

In a first course in programming, you may have drawn lines, boxes, triangles, etc. These are not difficult. In this lab, the shapes will be a bit more challenging. You have some choice in which shapes you draw. Consider arrows: left(), up(^), down(v).),>Choose any one of these four characters to draw. They require slanted lines.

Example 1: the ^ shape, or up-arrow. It can drawn with different heights, or number of rows. For a pixel (picture element) use a single *, star, or asterix.

height: 1 2 3 4 5

V-shape: * * * * *

* * * * * * * *

* * * * * *

* * * *

* *

Example 2: the V shape, or down-arrow:

height: 1 2 3 4 5

V-shape: * * * * * * * * *

* * * * * * *

* * * * *

* * *

*

Example 3: the > shape, or right-arrow. This is about the best you can do for small and even > arrows:

height: 1 2 3 4 5

V-shape: * * * * *

* * * *

* * *

* *

*

Next consider letters A-Z. Choose any two different letters, one from your first name and one from your last name. Some letters are easier to draw than others; You can pick which two: one from your first name and one from your last name. They have to be different letters. Draw these as uppercase, square, block letters; no curves or slants are required.

Some letters are easier, such as T, L, I and X. Some are more difficult, such as M, W and K. You get to pick which two letters to draw. Your initials (first letter of first name, first letter of last name) are a good choice, but if your name is Melinda Keller, you might want to pick A and L rather than M and K. If you already have the ^-shape working, then the A shape is not much more work. You need three different shapes; using V-arrow and V for a letter is not valid.

The one arrow character shape and the two letter character shapes are the three shapes to implement and test.

Startup code is provided. It provides a menu-driven loop for box, forward slash(/) and backward slash(\) characters. You can keep, delete, and or modify the startup code as you wish. Your code can use one or more nested loops. The for-loop is a good choice. It is appropriate for looping a specific number of rows or columns. See chapter 5, top of page 270 (8ed), page 271 (9ed), page 275 (10ed) for code that will loop using a for-loop.

IMPORTANT HINT:To create a series of characters in a line in C++, it is easier to use:string(length, 'x');instead of using a for loop:for(int count{}; count This is like Python:print(length * 'x') or print('x'* length)

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_2

Step: 3

blur-text-image_3

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

The Core Ios Developer S Cookbook Core Recipes For Programmers

Authors: Erica Sadun ,Rich Wardwell

5th Edition

0321948106, 978-0321948106

More Books

Students also viewed these Programming questions

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

What are the role of supervisors ?

Answered: 1 week ago

Question

Why do so many foreign companies build facilities in the U.S.?

Answered: 1 week ago