Advertisement
Guest User

hugo

a guest
Dec 9th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Schwein
  5. {
  6. private:
  7. int groesse;
  8. float gewicht;
  9. int saettigung;
  10.  
  11. public:
  12. void wachsen(void);
  13. //void init(void);
  14. void ausgabe(void);
  15. Schwein();
  16. };
  17.  
  18. void Schwein::wachsen(void)
  19. {
  20. groesse++;
  21. }
  22.  
  23. /*
  24. void Schwein::init(void)
  25. {
  26. groesse = 20;
  27. gewicht = 0.5;
  28. saettigung = 30;
  29. }
  30. */
  31.  
  32. void Schwein::ausgabe(void)
  33. {
  34. cout << "Das Schwein ist " << groesse << " cm gross" << endl;
  35. cout << "Das Schwein ist " << gewicht << " kg schwer" << endl;
  36. cout << "Das Schwein ist " << saettigung << " % gesaettigt" << endl;
  37. }
  38.  
  39. Schwein::Schwein()
  40. {
  41.  
  42. }
  43.  
  44. int main()
  45. {
  46. Schwein Hugo;
  47. Hugo.init();
  48. Hugo.ausgabe();
  49. Hugo.wachsen();
  50. getchar();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement