Let's start with question# 4 -
CalculateArea
, like the name suggests, is supposed to calculate the area, given a room's dimensions. It's not supposed to do anything else, like getting input, printing the area etc.
Therefore,
CalculateArea
might look like this:
1 2 3 4 5 6
|
int CalculateArea(int width, int length) {
int area = (width * length);
return area;
}
|
Now question# 3 -
DisplayArea
, like the name suggests, is supposed to display the area, given a room's dimensions. It's not supposed to do anything else, like calculating the area, etc.
Therefore,
DisplayArea
might look like this:
1 2 3 4 5 6 7
|
void DisplayArea(int width, int length) {
int area = CalculateArea(width, length);
std::cout << "The area is: " << area << std::endl;
}
|
As for question# 5, this seems to be a duplicate of what's being asked on question# 4 with
CalculateArea
. I don't see a real difference.
Don't forget to answer the second part of each question - providing an example of how each function might be called, and whether their parameters are passed by value or reference.