Question
Function 1 printDottedLine: Write the definition of a function printDottedLine, which has no parameters and doesn't return anything. The function prints to standard output
Function 1 – printDottedLine:
- Write the definition of a function printDottedLine, which has no parameters and doesn't return anything. The function prints to standard output a single line (terminated by a new line character) consisting of 5 periods.
- Write a statement that calls printDottedLine.
- Write a statement that declares a prototype for the function printDottedLine, which has no parameters and doesn't return anything.
- Move the function printDottedLine definition after the main function, compile it until it is error free and runs correctly to produce the correct output.
B. Function 2 – printErrorDescription
- Write a statement that declares a prototype for a function printErrorDescription, which has an int parameter and returns nothing.
- Write the definition of a function printErrorDescription, which has an int parameter and doesn't return anything. The function prints an “error message” if the number 14 is passed to it. If any other number is passed to it, it prints “success”.
- Write a statement that calls the function printErrorDescription, passing it the value 14.
- Write a statement that calls the function printErrorDescription, passing it the value 10.
C. Function 3 – printLarger
- printLarger is a function that accepts two int parameters and returns no value.
Two int variables, sales1 and sales2, have already been declared and initialized.
Write a statement that calls printLarger, passing it sales1 and sales2.
- Write a statement that declares a prototype for a function printLarger, which has two int parameters and returns no value.
- Write the definition of a function printLarger, which has two int parameters and returns nothing. The function prints the larger value of the two parameters to standard output on a single line by itself. (For purposes of this exercise, the "larger" means "not the smaller".)
D. Function 4 – printGrade
- Write the definition of a function printGrade, which has a char parameter and returns nothing. The function prints on a line by itself the message string Grade: followed by the char parameter (printed as a character) to standard output. Don't forget to put a new line character at the end of your line.
Thus, if the value of the parameter is 'A', the function prints out Grade: A
E. Function 5 - printAttitude
- Write the definition of a function printAttitude, which has an int parameter and returns nothing. The function prints a message to standard output depending on the value of its parameter.
- If the parameter equals 1, the function prints disagree
- If the parameter equals 2, the function prints no opinion
- If the parameter equals 3, the function prints agree
- In the case of other values, the function does nothing.
- Each message is printed on a line by itself.
2. Write a prototype for the function and a statement that calls the function.
F. Function 6 – dashedLine
- Write the definition of a function dashedLine, with one parameter, an int.
If the parameter is negative or zero, the function does nothing. Otherwise it prints a complete line terminated by a new line character to standard output consisting of dashes (hyphens) with the parameter's value determining the number of dashes. The function returns nothing.
2. Write a prototype for the function and a statement that calls the function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here are the requested functions and statements A Function 1 printDottedLine include Function protot...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started