Learning Objectives: a.Build functions that return a value b.Determine when to o
ID: 3705778 • Letter: L
Question
Learning Objectives:
a.Build functions that return a value
b.Determine when to overload functions
c.Examine value-returning functions, including actual and formal parameters
d.Explore how to construct and use a value-returning, user-defined function in a program
e.Construct and use void functions in a program
f.Discover the difference between value and reference parameters
g.Explore reference parameters and value-returning functions
Instructions:
Read in your text book or google the Web; if you use the Web, then you must include the link(s) you used for help you formulate your response.
Respond to item b by explaining what it means to overload a function, be concise and to the point
Respond to item c by comparing and contrasting actual and formal parameters, be concise and to the point
Respond to item f by explaining the difference between value and reference parameters, be concise and to the point
Explanation / Answer
Hi Dear,
Question is long.
I have answered first 3 points.
Please repost others in separate post.
a.Build functions that return a value
function "sum" takes two parameter and return the sum of two integers
int sum(int x, int y) {
return (x+y);
}
b.Determine when to overload functions
When purpose of function is same but types or number of parameters are
differen the we overload functions
// add two integers
int sum(int x, int y) {
return (x+y);
}
// add two double
double sum(double x, double y) {
return (x+y);
}
c.Examine value-returning functions, including actual and formal parameters
value returning function:
int sum(int x, int y) {
return (x+y);
}
formal parameters: x, y
int x = 6, y = 8;
sum(x, y); // actual parameter: x, y
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.