Answer to Question #268483 in C++ for bob

Question #268483

 The Picture class has a Rectangle variable rectangle and has a color variable (a string) as well. Create the constructor for Picture.


1
Expert's answer
2021-11-19T17:15:01-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS