fork download
  1. #include <iostream>
  2. using namespace std;
  3. class sap
  4. {
  5. public:
  6. void disp(int a,int b)
  7. {
  8. cout<<"enter the 1st no"<<endl;
  9. cin>>a;
  10. cout<<"enter the 2nd no"<<endl;
  11. cin>>b;
  12. a=a+b;
  13. b=a-b;
  14. a=a-b;
  15. cout<<"1st no a="<<a<<endl;
  16. cout<<"2nd no b"<<b<<endl;
  17. }
  18. void disp(float x,float y)
  19. {
  20. cout<<"enter the 1st no"<<endl;
  21. cin>>x;
  22. cout<<"enter the 2nd no"<<endl;
  23. cin>>y;
  24. x=x+y;
  25. y=x-y;
  26. x=x-y;
  27. cout<<"1st no x="<<x<<endl;
  28. cout<<"2nd no y"<<y<<endl;
  29. }
  30. };
  31. int main()
  32. {
  33. int a,b;
  34. sap ob;
  35. ob.disp(a,b);
  36. ob.disp(x,y);
  37. return 0;
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:36:11: error: ‘x’ was not declared in this scope
   ob.disp(x,y);
           ^
prog.cpp:36:13: error: ‘y’ was not declared in this scope
   ob.disp(x,y);
             ^
stdout
Standard output is empty