The Picture class has a Rectangle variable rectangle and has a color variable (a string) as well. Create the constructor for Picture.
#include <iostream>
using namespace std;
class Picture{
public:
string color;
rectangle(void);//constructor declaration
};
Picture:: rectangle() // constructor Definition
{
double length;
double width;
}
int main()
{
double length, width;
Picture P1; // Constructor called
cout<<"Enter the picture color, length and width respectively"<<endl;
cin>>P1.color>>length>>width;
cout<<"Color is: "<<P1.color<<" Length is: "<<length<<" Width is: "<<width<<endl;
return 0;
}
Comments
Leave a comment