Advertisement Remove all ads

Write a Program in C++ Using Oop Technique to Compute Cirumference of Circle - Computer Science 1

Write a program in C++ using OOP technique to compute the circumference of a circle

Advertisement Remove all ads

Solution

#include 
class circle
{
 public : float r, c ;
    public : void accept()
    {
       cout << "Enter radius" ;
       cin >> r ;
    }
    void compute ()
    {
       c = 2 * 3.14 * r;
    }
    void print ()
    {
       cout << "circumference is : " << c;
    }
};
void main ()
{
circle obj;
obj.accept();
obj.compute();
obj.print();
getch();
}
Concept: C++ Programming
  Is there an error in this question or solution?
Advertisement Remove all ads

APPEARS IN

Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×