This program does not compile! Spot the error and give the line number. Presume that the header file is error free and
C++
This
// Implementation file for the Rectangle class.
1. #include "Rectangle.h" // Needed for the Rectangle class
2. #include <iostream> // Needed for cout
3. #include <cstdlib> // Needed for the exit function
4. using namespace std;
//***********************************************************
// setWidth sets the value of the member variable width. *
//***********************************************************
5. void Rectangle::setWidth(double w)
{
6. if (w >= 0)
7. width = w;
8. else
{
9. cout << "Invalid width\n";
10. exit(EXIT_FAILURE);
}
}
//***********************************************************
// setLength sets the value of the member variable length. *
//***********************************************************
11. void Rectangle::setLength(double len)
{
12. if (len >= 0)
13. length = len;
14. else
{
15. cout << "Invalid length\n";
16. exit(EXIT_FAILURE);
}
}
//***********************************************************
// getWidth returns the value in the member variable width. *
//***********************************************************
17. double Rectangle::getWidth() const
{
18. return width;
}
//*************************************************************
// getLength returns the value in the member variable length. *
//*************************************************************
19. double Rectangle::getLength() const
{
20. return length++;
}
//************************************************************
// getArea returns the product of width times length. *
//************************************************************
21. double Rectangle::getArea() const
{
return width * length;
}
Options:

Trending now
This is a popular solution!
Step by step
Solved in 2 steps

these are the options,








