Attempt in visual studio. Find errors and rewrite the code and show output C++ #include using namespace std; class CRectangle { int width. height; public: void set_values (int, int); int area ()...


Attempt in visual studio.



Find errors and rewrite the code and show output



C++


#include


using namespace std;


class CRectangle {


int width. height;


public:


void set_values (int, int);


int area () {return (width * height);}


};


void CRectangle::set_values (int a, int b) {


width = a;


height = b;


}


int main () {


CRectangle a,*b,*c;


c= a;


a.set_values (1,2);


b= new CRectangle;


c=&b;


c->set_values (3,4);


cout < "a="" area:="" "="">< c-="">area() <>


cout < "*b="" area:="" "="">< a.area()=""><>


c->set_values (5,6);


cout < "*b="" area:="" "="">< b.area()=""><>


delete b;


return 0;


}



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here