- Exclude Any Existing Source Code Files That May Already Be In Your Ide Project And Add A New One Naming It C1a2e3 Main 1 (61.02 KiB) Viewed 26 times
Exclude any existing source code files that may already be in your IDE project and add a new one, naming it C1A2E3_main.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Exclude any existing source code files that may already be in your IDE project and add a new one, naming it C1A2E3_main.
Exclude any existing source code files that may already be in your IDE project and add a new one, naming it C1A2E3_main.cpp. Write a program in that file to display a triangle of characters. 1. Declare two const char variables named LEADER_CHAR and DIAGONAL_CHAR in two separate statements on two separate lines. In the same statements, initialize them to character literals representing the leader and diagonal characters, respectively, illustrated below. DO NOT refer to those characters literally or by their actual names ("circumflex" and "dollar") in other code or in any comments because doing so would be an inappropriate use of "magic numbers". 2. Prompt (ask) the user to enter any positive decimal integer value. 3. Use nested "for" loops to display that number of lines of characters on the console screen starting in column 1, with each successive line containing one more character than the previous. Each line must end with the diagonal character and any preceding characters must be leader characters. The first line will only contain the diagonal character. For example, if the user inputs a 4, the leader character is ^, and the diagonal character is $, the following will be displayed: $ ^$ ^^$ ^^^$ 4. DO NOT use more than two loop statements. Manually re-run your program several times, testing with several different line counts, leader characters, and diagonal characters. To change the leader and diagonal characters you must change the character literals assigned to the LEADER_CHAR and DIAGONAL_CHAR variables and recompile.