#include <iostream>
#include <cmath>
using namespace std;
class Rectangle {
public:
int width, height;
Rectangle();
~Rectangle();
double r_area();
double r_perimeter();
};
Rectangle::Rectangle()
{
width = 1;
height = 1;
}
Rectangle::~Rectangle()
{
}
double Rectangle::r_area()
{
return (width * height);
}
double Rectangle::r_perimeter()
{
return (2*width + 2* height);
}
int main ()
{
cout<< "Defaults:" << endl;
Rectangle r;
cout << "Rectangle area = " << r.r_area() << " Perimeter = " << r.r_perimeter() << endl;
cout << "Rectangle: Please enter length and width: ";
cin >> r.height, r.width ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<ERROR
cout << "Rectangle area = " << r.r_area() << " Perimeter = " << r.r_perimeter() << endl;
system("pause");
return 0;
}
I am trying to take a user input for width and height but I have a problem in the Cin;
Any ideas?
thanks :)