Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Apple_tree
- {
- int grew;
- int wormy;
- int broken_up;
- public:
- int Dasha_gave;
- void set_grew();
- void set_threw_out();
- void remained(int Dasha_gave);
- };
- void Apple_tree::set_grew()
- {
- grew=10;
- }
- void Apple_tree::set_threw_out()
- {
- wormy=1;
- broken_up=3;
- }
- void Apple_tree::remained(int Dasha_gave)
- {
- cout<<"Ostalos'"<<grew-(wormy+broken_up+Dasha_gave)<<" yablok";
- }
- int main ()
- {
- Apple_tree a;
- cout<<"Zadacha \n";
- cout<<"Viroslo 10 yablok, iz nix ,bilo 1 4ervivoe, 3 razbilos' \n";
- cout<<"Skol'ko yablok my otdadim dashe?";
- cin>>a.Dasha_gave;
- a.set_grew();
- a.set_threw_out();
- a.remained(a.Dasha_gave);
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment