33.6k views
3 votes
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 functionfunc1?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 eachactual parameter, and in what order should you use these parameters in a call to the functionfunc1?f. Write a C++ statement that prints the value returned by the function func1 with the actualparameters 3 and 8.5.g. Write a C++ statement that prints the value returned by function join with the actualparameters "John" and "Project Manager", respectively.h. Write a C++ statement that prints the next character returned by function func3. (Use yourown actual parameters.)

1 Answer

7 votes

Final answer:

The functions func1, func2, func3, and join have 2, 3, 4, and 2 parameters respectively, and their return types are int, double, char, and string. To call func1, two actual parameters are needed: an int and a double. Examples of C++ statements to call these functions and print their returned values are provided.

Step-by-step explanation:

The function func1 has two parameters, an int and a double. The return type of func1 is int.

The function func2 has three parameters: a string, an int, and a double. The return type of func2 is double.

func3 has four parameters, two of type int, one of type double, and one of type char. The return type of func3 is char.

The function join has two parameters, both of type string. The return type of join is string.

To call func1, you need two actual parameters: an int and a double, in that order.

To print the value returned by func1 with actual parameters 3 and 8.5, we use the statement: std::cout << func1(3, 8.5).

To print the value returned by join with "John" and "Project Manager", the statement would be: std::cout << join("John", "Project Manager").

To print the next character returned by func3, you could use: std::cout << func3(1, 2, 3.14, 'a'), substituting with your own actual parameters as needed.

User Ray Hulha
by
6.1k points