ya_zay4eg

Untitled

May 10th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class Apple_tree
  4. {
  5.     int grew;
  6.     int wormy;
  7.     int broken_up;
  8. public:
  9.     int Dasha_gave;
  10.     void set_grew();
  11.     void set_threw_out();
  12.     void remained(int Dasha_gave);
  13. };
  14. void Apple_tree::set_grew()
  15. {
  16.     grew=10;
  17. }
  18. void Apple_tree::set_threw_out()
  19. {
  20.     wormy=1;
  21.     broken_up=3;
  22. }
  23. void Apple_tree::remained(int Dasha_gave)
  24. {
  25.     cout<<"Ostalos'"<<grew-(wormy+broken_up+Dasha_gave)<<" yablok";
  26. }
  27. int main ()
  28. {
  29.     Apple_tree a;
  30.     cout<<"Zadacha \n";
  31.     cout<<"Viroslo 10 yablok, iz nix ,bilo 1 4ervivoe, 3 razbilos' \n";
  32.     cout<<"Skol'ko yablok my otdadim dashe?";
  33.     cin>>a.Dasha_gave;
  34.     a.set_grew();
  35.     a.set_threw_out();
  36.     a.remained(a.Dasha_gave);
  37.     system ("pause");
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment