Output not showing fix it.
Need output of this code only.
Tasks which i perform already :
In the main program, create two objects of classCircle. Find which of the two circles is smaller (by comparing their radii) and enlarge the smaller circle by a factor of 2.
Code :
#includeusing namespace std;//Class which holds properties and methods of a classclass Circle { private: int radius; int x; int y; public: //Parameterized constructor that creates an object Circle(int r=0, int xc=0, int yc=0) { radius=r; x=xc; y=yc; } //Member function to find area int area() { return 22*radius*radius/7; } //Member function to find circumference int circumference(){ return 2*22*radius/7; } //Member function to print results void print(int ar, int cf) { cout<"area of="" circle="" with="" radius="">"area><><" is="">"><><" and="" circumference="" of="" circle="" is="">"><><> } //set methods void setRadius(int r) { radius=r; } void setX(int xc) { x=xc; } void setY(int yc) { y=yc; } //get methods int getRadius() { return radius; } int getX() { return x; } int getY() { return y; } void enlargeCircle(int c) { radius=c*radius; } void moveHorizontal(int c) { x=x+c; } void moveVertical(int c) { y=y+c; } //Member function to display data members void printMembers() { cout < "x="" coordinate:="" "="">< x=""><> cout < "y="" coordinate:="" "="">< y=""><> cout < "radius:="" "="">< radius=""><> }};int main(){ Circle c1(49),c2(61); //Creating two objects of class circle if(c1.getRadius() c1.enlargeCircle(2); //enlarge it by 2 else if(c2.getRadius() c2.enlargeCircle(2); //enlarge it by 2 return 0;}
using namespace std;
//Class which holds properties and methods of a classclass Circle { private: int radius; int x; int y; public:
//Parameterized constructor that creates an object Circle(int r=0, int xc=0, int yc=0) { radius=r; x=xc; y=yc; } //Member function to find area int area() { return 22*radius*radius/7; }
//Member function to find circumference int circumference(){ return 2*22*radius/7; } //Member function to print results void print(int ar, int cf) { cout<"area of="" circle="" with="" radius="">"area><><" is="">"><><" and="" circumference="" of="" circle="" is="">"><><> } //set methods void setRadius(int r) { radius=r; } void setX(int xc) { x=xc; } void setY(int yc) { y=yc; } //get methods int getRadius() { return radius; } int getX() { return x; } int getY() { return y; } void enlargeCircle(int c) { radius=c*radius; } void moveHorizontal(int c) { x=x+c; } void moveVertical(int c) { y=y+c; } //Member function to display data members void printMembers() { cout < "x="" coordinate:="" "="">< x=""><> cout < "y="" coordinate:="" "="">< y=""><> cout < "radius:="" "="">< radius=""><> }};int main(){ Circle c1(49),c2(61); //Creating two objects of class circle if(c1.getRadius() c1.enlargeCircle(2); //enlarge it by 2 else if(c2.getRadius() c2.enlargeCircle(2); //enlarge it by 2 return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here