myGully.com Boerse.SH - BOERSE.AM - BOERSE.IO - BOERSE.IM Boerse.BZ .TO Nachfolger
Zurück   myGully.com > Computer & Technik > Programmierung
Seite neu laden

[TP]Algorithmus

Willkommen

myGully

Links

Forum

 
Antwort
 
Themen-Optionen Ansicht
Ungelesen 05.02.12, 17:45   #1
Your_Conscience
Hinter dir!
 
Registriert seit: Apr 2010
Beiträge: 1.124
Bedankt: 487
Your_Conscience ist noch neu hier! | 0 Respekt Punkte
Standard

Code:
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int max1st = INT_MIN, max2nd = INT_MIN, h;
    
    while (1) {
          printf("Bitte Zahl eingeben: ");
          scanf("%d", &h);
          if (h >= max1st) {
             max2nd = max1st;
             max1st = h;
          } else if (h > max2nd) max2nd = h;
          if (max1st > INT_MIN) printf("1. groesste Zahl: %d\n", max1st);
          if (max2nd > INT_MIN) printf("2. groesste Zahl: %d\n", max2nd);
    }

    return EXIT_SUCCESS;
}
Your_Conscience ist offline   Mit Zitat antworten
Antwort


Forumregeln
Du kannst keine neue Themen eröffnen
Du kannst keine Antworten verfassen
Du kannst keine Anhänge posten
Du kannst nicht deine Beiträge editieren

BB code is An
Smileys sind An.
[IMG] Code ist An.
HTML-Code ist Aus.

Gehe zu


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:02 Uhr.


Sitemap

().