Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Zufallszahl2.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <ctime>
  7. using namespace std;
  8.  
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12.     srand (static_cast<unsigned int>(time(NULL)));
  13.     int zz = rand() % 101//zz = Zufallszahl
  14.     int anzahl;             //anzahl = Anzahl der Ratedurchgänge
  15.     int ez;                 //ez = Eigene Zahl
  16.  
  17.  
  18.  
  19.     {  
  20.         cout << "Bitte geben Sie die Anzahl der Ratedurchgaenge ein : ";
  21.         cin >> anzahl;
  22.         cout << endl;
  23.     }
  24.  
  25.     {
  26.         for(int i = 1; i <= anzahl; i=i+1)
  27.         {
  28.             {
  29.                 {
  30.                     {
  31.                         cout << " Geben sie bitte ihre Zahl ein : ";
  32.                         cin >> ez;
  33.                         cout << "Das ist Durchgang: " << (i) << " ";
  34.    
  35.  
  36.                         if(ez > zz)
  37.                         {
  38.                              cout << "Die Zahl " << ez << " ist groesser als " << "die Zufallszahl! ";
  39.                         }
  40.                     }
  41.                
  42.                     if(ez < zz)
  43.                     {
  44.                         cout << "Die Zahl " << ez << " ist kleiner als " << "die Zufallszahl! ";
  45.                     }
  46.                 }  
  47.            
  48.  
  49.  
  50.                 {  
  51.                     if(ez == zz)                           
  52.                         cout << "Herzlichen Glückwunsch! Die Zufallszahl ist : " << zz ;
  53.                    
  54.                     break;
  55.                 }
  56.                
  57.            
  58.                
  59.                
  60.                 {
  61.                     for(int i=anzahl;1<2;1<2)
  62.                     {
  63.                         cout << "           :( Game Over! :(            ";
  64.                         break;
  65.                     }
  66.                 }
  67.  
  68.             }
  69.         }
  70.        
  71.         return 0;
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement