diff options
| author | tafaar <[email protected]> | 2022-10-18 14:55:44 -0700 |
|---|---|---|
| committer | tafaar <[email protected]> | 2022-10-18 14:55:44 -0700 |
| commit | 97af78689b7d4ad25def0c99c331550d82613c88 (patch) | |
| tree | fcd6155f02e191bab50695da04d04f078c5a4724 | |
| parent | edited declaration of printresults (diff) | |
| download | cst116-ch9-debugging-hill-main.tar.xz cst116-ch9-debugging-hill-main.zip | |
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging-Flowchart.txt | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Flowchart.txt b/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Flowchart.txt index 6fb6924..79fa79b 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Flowchart.txt +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging-Flowchart.txt @@ -12,4 +12,42 @@ DECLARE FUNCTIONS: int GetAge(); int CalcDays(int age); void PrintResults(int days, age); -
\ No newline at end of file + +int main{ + SET int age = 0; + SET int days = 0; + + + SET age WITH FUNCTION GetAge(); + SET days WITH FUNCTION CalcDays(age); + + CALL PrintResults(days, age); + + return 0; +} + +CREATE FUNCTION int GetAge(){ + + DECLARE int age; + + PRINT "Please enter your age:" + SET age TO input; + + RETURN age; +} + +CREATE FUNCTION int CalcDays(int years){ + + DECLARE int days; + + SET days TO years * DAYS_PER_YEAR; + + RETURN days; +} + +CREATE FUNCTION void PrintResults(int days, int age){ + + PRINT age + "! Boy are you old! \NEWLINE"; + PRINT "Did you know you are at least " + days + " old? \NEWLINE \NEWLINE"; + +}
\ No newline at end of file |