Question
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 :
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
// 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started