Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #define MAX 1
- int main(void)
- {
- //Deklaration
- int iMainZahl;
- int iEingabe;
- int Counter = 0;
- int iCounter=15;
- iMainZahl = 0;
- srand(time(NULL));//init vom Zufallsgenerator
- iMainZahl = 1 + rand() % 100;
- printf("%d", iMainZahl);
- do{
- do
- {
- Counter++;
- printf("\nRaten(Versuch %d von %d):\t", Counter, iCounter);
- scanf_s("%d", &iEingabe);
- if (iEingabe < iMainZahl) { printf("Die Zahl ist zu NIEDRIG."); }
- else if (iEingabe > iMainZahl) { printf("Die Zahl ist zu HOCH."); }
- else { printf("Sie haben die Zahl herausgefunden.(%d Versuche)", Counter); iCounter = Counter; Counter = 0; }
- } while (Counter < iCounter && iEingabe != iMainZahl);
- } while (Counter < iCounter);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement