program for add,sub,div,mul


SUBMITTED BY: RavishBhatt

DATE: June 27, 2016, 8:01 a.m.

UPDATED: June 27, 2016, 8:27 a.m.

FORMAT: C++

SIZE: 758 Bytes

HITS: 516

  1. # include<iostream.h>
  2. # include<conio.h>
  3. class number
  4. {
  5. public:
  6. int a,b;
  7. void getdata()
  8. {
  9. cout<<"enter the value of a";
  10. cin>>a;
  11. cout<<"enter the value of b";
  12. cin>>b;
  13. }
  14. };
  15. class addition : public number
  16. {
  17. public:
  18. int sum;
  19. void display();
  20. {
  21. sum=a+b;
  22. cout<<"the value of sum is="<<sum<<endl;
  23. }
  24. };
  25. class subtraction : public number
  26. {
  27. public:
  28. int sub;
  29. void show();
  30. {
  31. sub=a-b;
  32. cout<<"the value of sub is="<<sub<<endl;
  33. }
  34. };
  35. class multiplication : public number
  36. {
  37. public:
  38. int mul;
  39. void replay();
  40. {
  41. mul=a*b;
  42. cout<<"the value of mul is="<<mul<<endl;
  43. }
  44. };
  45. void main()
  46. {
  47. clrscr();
  48. number n;
  49. addition a;
  50. subtraction s;
  51. multiplication m;
  52. n.getdata();
  53. a.display();
  54. s.show();
  55. m.replay();
  56. getch();
  57. }

comments powered by Disqus