fork download
  1. #include<iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. class cal
  6. {
  7. int x;
  8. public:
  9. cal()
  10. {
  11. cout<<"enter a number: ";
  12. cin>>x;
  13. if(x==0||x==1)
  14. {
  15. cout<<x;
  16. }
  17. else
  18. {
  19. double result;
  20. result = sqrt(double (x));
  21. cout<<result;
  22. }
  23. }
  24.  
  25. };
  26.  
  27. int main()
  28. {
  29. cal ob;
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
enter a number: 181.014