Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this lab you add two for loops to print an asterisk * or a space in columns and rows to print out

In this lab you add two for loops to print an asterisk "*" or a space " " in columns and rows to print out the letter A. The outer loop goes through each row. The inner loop moves from column to column. The inner loop will contain if then else statements that will decide whether to print an asterisk or a space. When a column is complete you have to print an endline statement.

The output will look like :

image text in transcribed

1. Open the source code file named LetterASt.cpp in Dev C++

2. Write the for loops to control the number of rows and columns that make up the letter A. The outer loop should go through the rows and the inner loop through the columns.

3. In the inner loop write the if then else statements to decide when to print an asterisk or a space.

4. Decide where you will need an end line statement to be printed after you have finished printing out a row and add it to the code in the proper place.

5. Compile and run your program. Submit your completed source file.

// LetterA.cpp - This program prints the letter A with 5 asterisks across and 6 asterisks down. // Input: None // Output: Prints the outline of the letter A.

#include #include using namespace std; int main() { const int LAST_COL_NUMBER = 5; // Number of Columns const int LAST_ROW_NUMBER = 6; // Number of Rows int row; // Loop control for row number int column; // Loop control for column number // Write a for loop to control the number of rows.

// Write a loop to control the number of columns // IF row 1 or 3 Print asterisk in every column // ElSE IF column1 print an asterisk in column 1 // ELSE IF it is the last column print an asterisk // ELSE Print a space instead of an asterisk // EndForLoop // EndForLoop // Write and place a statement that will print a newline after each row is complete - hint it is not here! } return 0; } // End of main()

EFSC Spring 2015 COP 1000 Principles of Programmingunstructor Material Spring 2015\Workboo Process exited after 1.02457 seconds with return value 0 Press any key to continue

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions