exercise:Ea8e2c74c4: Difference between revisions

From Stochiki
(Created page with "Write a function that outputs a right isosceles triangle of height and width ''n'', so ''n = 3'' would look like <pre> * ** *** </pre>")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Write a function that outputs a right isosceles triangle of height and width ''n'', so ''n = 3'' would look like
1. Build a program where control passes from main to four different functions with 4 calls.
<pre>
 
*
2. Now make a while loop in main with the function calls inside it. Ask for input at the beginning of the loop. End the while loop if the user hits Q
**
 
***
3. Next add conditionals to call the functions when the user enters numbers, so 1 goes to function1, 2 goes to function 2, etc.
</pre>
 
4. Have function 1 call function a, which calls function b, which calls function c
 
5. Draw out a diagram of program flow, with arrows to indicate where control goes

Latest revision as of 18:37, 13 May 2024

1. Build a program where control passes from main to four different functions with 4 calls.

2. Now make a while loop in main with the function calls inside it. Ask for input at the beginning of the loop. End the while loop if the user hits Q

3. Next add conditionals to call the functions when the user enters numbers, so 1 goes to function1, 2 goes to function 2, etc.

4. Have function 1 call function a, which calls function b, which calls function c

5. Draw out a diagram of program flow, with arrows to indicate where control goes