Ergebnis 1 bis 5 von 5

Baum-Darstellung

  1. #1
    Gesperrt
    Registriert seit
    19.07.2008
    Beiträge
    251

    Standard return 0, return 1

    Code:
    #include <iostream>
    using namespace std;
    
    class KONTO
    {
          private:
          int KONTOSTAND;
          
          public:
          int WERT_AENDERUNG(int);
          int KONTOSTAND_LESEN();
    };
    
    int KONTO::WERT_AENDERUNG(int EINGABE) {
        if ((EINGABE>=0)&&(EINGABE<=100000)) {
           KONTOSTAND=EINGABE;
           return(1);
           }
           return(0);
    }
    
    int KONTO::KONTOSTAND_LESEN()
    {
        return (KONTOSTAND);
    }
    
    int main()
    {
        KONTO TESTKONTO;
        TESTKONTO.WERT_AENDERUNG(0);
        
        int ALTERNATIVE, WERT=0;
        
        cout << "K O N T O V E R W A L T U N G" << endl;
        do {
            cout << "1 = KONTOSTAND AENDERN" << endl;
            cout << "2 = KONTOSTAND LESEN" << endl;
            cout << "0 = Ender der Akton" << endl << endl;
            cout << "Ihre Wahl: ";
            cin >> ALTERNATIVE;
            
            switch (ALTERNATIVE) {
                   
                   case 1: cout << "Neuer WERT: ";
                           cin >> WERT;
                           if (TESTKONTO.WERT_AENDERUNG(WERT))
                           cout << "WERT geaendert." << endl << endl;
                           break;
                   case 2: cout << "Aktueller WERT: ";
                           cout << TESTKONTO.KONTOSTAND_LESEN() << endl << endl;
                           break;
            }
            } while (ALTERNATIVE != 0);
        
        system("pause");
        return 0;
    }
    Es geht um die Methode WERT_AENDERUNG(int), return gibt ja einen Wert an die Funktion WERT_AENDERUNG(int) zurück. Was bedeutet diese 1 oder die 0 nach return? Und warum die runden Klammern, in der main is ja bei return 0 auf keine Klammer um die 0.

    2. Frage: Was genau ist ein Kontruktor, Destruktor? Also jetzt nicht irgendwo copy&paste sondern mit eigenen Worten erklärt.
    Geändert von REFLΞX (17.07.2010 um 16:31 Uhr)

Ähnliche Themen

  1. Hooligans 3 Return of the Major FAKE or REAL ?
    Von Insanity im Forum Videos, Filme & Serien
    Antworten: 8
    Letzter Beitrag: 25.09.2010, 13:31

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •