Nov 6, 2013 at 11:37pm UTC
hello all, right now I have code
#include <iostream>
using namespace std;
class Rectangle
{
private:
double width;
double length;
public:
double area()
{
return width*length;
}
double perimeter()
{
return 2*width+2*length;
}
void setLength(double L)
{
length = L;
}
void setWidth(double W)
{
width = W;
}
};
int main()
{
Rectangle R;
R.setLength(5);
R.setWidth(4);
cout << R.area() << endl;
cout << R.perimeter() << endl;
Rectangle* pR = new Rectangle;
pR -> setLength(10);
pR -> setWidth(5);
cout << pR.area() << endl; // Call the area() function using pR
cout << pR.perimeter << endl; // Call the perimeter() function using pR
delete pR;
}
it gives error
any idea?
Nov 6, 2013 at 11:54pm UTC
I have an idea: copy and paste the exact errors you are getting, and don't mark topics solved unless they are solved ;)