Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following function prototypes: (3) int funcl (int, double, string);

ID: 3836491 • Letter: C

Question

Consider the following function prototypes: (3) int funcl (int, double, string); double func2 (int, double); char func3 (int, int, double char); string concat (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 concat have? What is the type of function concat? 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 funcl? f. Write a C++ statement that prints the value returned by the function func1 with the actual parameters 3, 3.5, and "four" g. Write a C++ statement that prints the value returned by function concat with the actual parameters "Peter Quill" and "Star Lord", respectively. h. Write a C++ statement that prints the next character returned by function func3. (Use your own actual parameters.)

Explanation / Answer

a) The function func1() has total 3 parameters. The function is of type int.

b) The function func2() has total of 2 parameters. The type of function is double.

c) The function func3() has total of 4 parametrs. The function is of char return type.

d) The function concat() has 2 parametrs. The function is of string return type.

e) We need 3 parametrs to call the function func1() . Type of parameters are int, double, and of string respectively.

Orders are. 1st int type, 2nd double type and 3rd string type. e.g.,

int n = func1(20, 23.56, "India");

f) The statement is cout<< func1(3, 3.5, "four");

g) cout<<concat("Peter Quill", "Star Lord");

h) cout<< func3(0, 2, 2.5, 'a');

Explanation: The values in the bracket of functions e.g., int func1(int, double, string) are known as parameters of the function. And the data type associated with the name of the function (e.g.,int func1(int, double, string) here it is of type int ) is known as type of function or simply called as its return type.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote