Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

41 lignes
600B

  1. #include "fcpp.hh"
  2. class Konto {
  3. public:
  4. Konto (int start); // Konstruktor
  5. ~Konto (); // Destruktor
  6. int kontostand ();
  7. int abheben (int betrag);
  8. private:
  9. int bilanz;
  10. } ;
  11. Konto::Konto (int startkapital)
  12. {
  13. bilanz = startkapital;
  14. print("Konto mit ",bilanz," eingerichtet",0);
  15. }
  16. Konto::~Konto ()
  17. {
  18. print("Konto mit ",bilanz," aufgelöst",0);
  19. }
  20. int Konto::kontostand () {
  21. return bilanz;
  22. }
  23. int Konto::abheben (int betrag)
  24. {
  25. bilanz = bilanz - betrag;
  26. return bilanz;
  27. }
  28. int main ()
  29. {
  30. Konto k1(100), k2(200);
  31. k1.abheben(50);
  32. k2.abheben(300);
  33. }