TASK 3: Write C++ code to prompt the user for the number of '-' characters on the first row. Repeatedly re-prompt the user if the value entered is not at least two. Compile, run, and test this solution before continuing to the next task. TASK 4: Write C++ code to prompt the user for the total number of rows to display. Repeatedly re-prompt the user if any row would not have at least two '-' characters. TASK 5: Write C++ code to display the inverted trapezoid given the values entered in TASK 3 and TASK 4. Be sure that there is a comment documenting each variable (see the document on Carmen under Modules on how to comment your code). Do not start a variable name with a capital letter. Be sure that your code is properly indented, readable, and use good descriptive names. Test your solution.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

TASK 3: Write C++ code to prompt the user for the number of '-' characters on the first row. Repeatedly re-prompt the user if the value entered is not at least two. Compile, run, and test this solution before continuing to the next task.

TASK 4: Write C++ code to prompt the user for the total number of rows to display. Repeatedly re-prompt the user if any row would not have at least two '-' characters.

TASK 5: Write C++ code to display the inverted trapezoid given the values entered in TASK 3 and TASK 4.

  • Be sure that there is a comment documenting each variable (see the document on Carmen under Modules on how to comment your code).

  • Do not start a variable name with a capital letter. Be sure that your code is properly indented, readable, and use good descriptive names.

  • Test your solution.

 

 

Test 1
> run
Enter size of top: -1
Size of top row must be at least two.
Enter size of top: 0
Size of top row must be at least two.
Enter size of top: 1
Size of top row must be at least two.
Enter size of top: 2
Enter number of rows: 1
--
Test 2
> run
Enter size of top: -5
Size of top row must be at least two.
Enter size of top: 2
Enter number of rows:
-1
Invalid number of rows.
Enter number of rows: 0
Invalid number of rows.
Enter number of rows:
2
Invalid number of rows.
Enter number of rows:
4
Invalid number of rows.
Enter number of rows: 1
Transcribed Image Text:Test 1 > run Enter size of top: -1 Size of top row must be at least two. Enter size of top: 0 Size of top row must be at least two. Enter size of top: 1 Size of top row must be at least two. Enter size of top: 2 Enter number of rows: 1 -- Test 2 > run Enter size of top: -5 Size of top row must be at least two. Enter size of top: 2 Enter number of rows: -1 Invalid number of rows. Enter number of rows: 0 Invalid number of rows. Enter number of rows: 2 Invalid number of rows. Enter number of rows: 4 Invalid number of rows. Enter number of rows: 1
Test 10
> run
Enter size of top: 13
Enter number of rows:
Test 11
> run
Enter size of top: 13
Enter number of rows:
1
Test 12
> run
Enter size of top: 13
Enter number of rows: 7
Invalid number of rows.
Enter number of rows:
6.
Transcribed Image Text:Test 10 > run Enter size of top: 13 Enter number of rows: Test 11 > run Enter size of top: 13 Enter number of rows: 1 Test 12 > run Enter size of top: 13 Enter number of rows: 7 Invalid number of rows. Enter number of rows: 6.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY