fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. class data
  4. {
  5. protected:
  6. int r;
  7. public:
  8. void read()
  9. {
  10. cout<<"Enter the radius";
  11. cin>>r;
  12. }
  13. };
  14. class area: public data
  15. {
  16. private:
  17. float result;
  18. public:
  19. void compute()
  20. {
  21. result=3.14*r*r;
  22. }
  23. void display()
  24. {
  25. cout<<"the area of the circle is";
  26. cin>>result;
  27. }
  28. };
  29. int main()
  30. {
  31. area a;
  32. a.read();
  33. a.compute();
  34. a.display();
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5484KB
stdin
Standard input is empty
stdout
Enter the radiusthe area of the circle is