Consider the following function prototypes: (30) int func1(int, double); double
ID: 3838941 • Letter: C
Question
Consider the following function prototypes: (30)
int func1(int, double);
double func2(string, int, double);
char func3(int, int, double, char);
string join (string, string);
Answer the following questions:
a. How many parameters does the function func1 have? What is the type of the function
func1?
b. How many parameters does function func2 have? What is the type of function func2?
c. How many parameters does function func3 have? What is the type of function func3?
d. How many parameters does function join have? What is the type of function join?
e. How many actual parameters are needed to call the function func1? What is the type of each
actual parameter, and in what order should you use these parameters in a call to the function
func1?
f. Write a C++ statement that prints the value returned by the function func1 with the actual
parameters 3 and 8.5.
g. Write a C++ statement that prints the value returned by function join with the actual
parameters "John" and "Project Manager", respectively.
h. Write a C++ statement that prints the next character returned by function func3. (Use your
own actual parameters.)
Explanation / Answer
a) int func1(int, double);
Function func1 have two parameters, in which one is int and the other is double.
Type of the function func1 is int.
b)
double func2(string, int, double);
Function func2 have Three parameters, which are string , int and double.
Type of the function func2 is double.
c)
char func3(int, int, double, char);
Function func3 have four parameters, which are of type int, int, double, char
Type of the function func3 is char.
d)
string join (string, string);
Function join have two parameters, which are of type string, string
Type of the function join is string.
e)
There are two actual parameters needed to call the func1.
The order of the parameters for calling func1 is int, double.
f)
The following c++ statement prints the value returned by the function func1.
cout<<func1(3,8.5);
g)
The following c++ statement prints the value returned by the function join.
cout<< join("John", "Project Manager”);
h)
The following c++ statement prints the next character returned by the function func3.
cout<<char(func3(3,5,6,7,'d')+1);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.