Hello all! I am in a beginner c++ class and have been struggling with this problem. I get a lot of error warnings but don't know what to do to fix it. I tried everything that I can think of and am now just guessing but without any success. Hope someone can suggest a strategy. Thanks, as always in advance.
The most recent error warning.....
error C2143: syntax error : missing ';' before 'tag::id'
fatal error C1004: unexpected end of file found
Error executing cl.exe.
Code:#include <iostream> using namespace std; class Rectangle { public: Rectangle(double = 1, double = 1); double setlength( double l ); double setwidth( double w ); double getlength(); double getwidth(); void area(); void perimeter(); private: double length; double width; }; Rectangle::Rectangle( double l, double w ) Rectangle::setlength( double l ) { length = ( l >= 0.0 && l <= 20.0 ) ? l = 0; } Rectangle::setwidth( double w ) { width = ( w >= 0.0 && w <= 20.0 ) ? w = 0; } void Rectangle::area() { return ( l * w ); } void Rectangle::perimeter() { return ( 2 * ( l * w )); } int main() { Rectangle rect( 4, 5 ); cout << " The area of the rectangle is " << rect.area() << endl; cout << " The perimeter of the rectangle is " << rect.perimeter() << endl; return 0; }