Programming
3.3 Guided PracticeUser-Defined Functions Using Parameters
When creating user-defined functions we can pass parameters into the function definition to be used in some way with those executable commands. We can also return values from the function definition back to the function call. This is one way we can address the variable scope restriction in any one function.
When defining the function's prototype, the data type before the function name represents the data type of the value being returned from the function call. The datatype and sometimes variable name inside of the parentheses after the function name represent the value being passed from the function call into the definition. Keep in mind that the void keyword is representative of no values being passed or returned.
For this exercise, you will be creating a function that passes a value (the year) into the function definition and then the function definition will make decisions to see if that year is a leap year. A value will be returned to the function call based on whether the year is a leap year or not. Be sure to pay attention to the function prototype and how it differs from the previous exercise.
Instructions
Follow these instructions to complete your assignment:
1. Use Flowgorithm to create the flowchart in the tab below.
2. Select the Code tab and enter the code into your compiler.
3. Compile your code and run. Your output should match the image on the Output tab.
4. Paste your flowchart and a screenshot of your output (including the Title Bar showing the path and name of your code) into a Word document (.docx).
5. Submit the “.c” code file, which should include a comment line with your name and the date.
6. Submit the Flowgorithm (.fprg) file.
7. Save your files and upload them using the instructions below.