subject

Your job is to write a program that prompts for a number of rows (r) from the user, then prints a parallelogram containing either r or rt1 rows. Your program may only print parallelograms of 3 to 23 rows, so you must force the value of r to be reasonable. After you get r, ifr is even, add one to get an odd number of rows. The upper part of the parallelogram must be right aligned with the point up. The lower part must abut the left margin. To draw the shape, you may only print single character spaces (' '), asterisks or stars (), and newline (\n'), flush or endl. You may not use any output manipulators, e. g., setw (), setfill(), in this program. Per the class design, you may use ONLY 3 LOOPS to print the shape itself, one to count rows, and one for the leading spaces and one for the stars on each row. Also, you MUST calculate the number of spaces and stars on a row from the row number and the total number of rows. You MAY NOT just initialize the values and adjust them up or down by one each row. For example (user entries in bold italic - and separate runs) 1 Enter number of rows: That is too few rows for me to make a parallelogram Enter number of rows: 30 That is too many rows for me to make a parallelogram Enter number of rows: 4 (notice this is changed to 5) Another run: Enter number of rows: 13 As usual, your prompts and error messages may contain any reasonable text. Don't skip a line after your prompt before drawing the parallelogram. Test with entries of too many rows, too few rows, a few even numbers of rows and a few odd numbers of rows. Include 3, 13 and 23 rows in your test set.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
question
Computers and Technology, 23.06.2019 11:30
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
You know the right answer?
Your job is to write a program that prompts for a number of rows (r) from the user, then prints a pa...
Questions
question
Mathematics, 15.08.2021 01:00
question
Mathematics, 15.08.2021 01:00
question
Mathematics, 15.08.2021 01:00
Questions on the website: 13722367