This lab will allow you to practice using value returning functions Please read all
directions before beginning. You will turn in two programs (L5_P1.cpp and L5_P2.cpp).
Be sure to include you and your partner’s name in the comments section of your program
(see the description in Blackboard.)
Problem 1. (Estimated time 15-20 mins)
When completed, the following program skeleton should ask the user for the length and
width of a yard, and then display the yard’s area. You must write the prototype, the
definition of the function calcArea and the function call to complete the program. Copy
and paste this program into the IDE.
//Program to calculate the area of a rectangular yard.
//L5_P1.cpp
#include <iostream>
using namespace std;
//Place prototype here for calcArea.
int main()
{
float length, width, area;
cout << “This program calculates the area of a\n”;
cout << “rectangular yard. It must know the yard’s \n”;
cout << “length and width. How long is the yard? “;
cin >> length;
cout << “How wide is the yard? “;
cin >> width;
area =//Place function call for calcArea here.
cout << “The area of the yard is “ << area;
return 0;
}
float calcArea(float len, float wide)
{
// Youmust write this function which is to calculate and return //
the area of the yard. Simplymultiply the length
// by the width and return the value.
}
the prof stated that all you have to change is the area portion. my question is to what
directions before beginning. You will turn in two programs (L5_P1.cpp and L5_P2.cpp).
Be sure to include you and your partner’s name in the comments section of your program
(see the description in Blackboard.)
Problem 1. (Estimated time 15-20 mins)
When completed, the following program skeleton should ask the user for the length and
width of a yard, and then display the yard’s area. You must write the prototype, the
definition of the function calcArea and the function call to complete the program. Copy
and paste this program into the IDE.
//Program to calculate the area of a rectangular yard.
//L5_P1.cpp
#include <iostream>
using namespace std;
//Place prototype here for calcArea.
int main()
{
float length, width, area;
cout << “This program calculates the area of a\n”;
cout << “rectangular yard. It must know the yard’s \n”;
cout << “length and width. How long is the yard? “;
cin >> length;
cout << “How wide is the yard? “;
cin >> width;
area =//Place function call for calcArea here.
cout << “The area of the yard is “ << area;
return 0;
}
float calcArea(float len, float wide)
{
// Youmust write this function which is to calculate and return //
the area of the yard. Simplymultiply the length
// by the width and return the value.
}
the prof stated that all you have to change is the area portion. my question is to what
Comment