Guest User

Untitled

a guest
Jan 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <cctype>
  3. #include <cstdlib>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. /*int main ()
  9. {
  10.     enum Type_Sorte_Carte {PIQUE,COEUR,CARREAU,TREFLE};
  11.  
  12.     int NombreAleatoire, CarteAleatoire, chiffre;
  13.  
  14.     Type_Sorte_Carte SorteCarte;
  15.  
  16.     char Sorte[3];
  17.  
  18.     string TropHaut, TropBas, Bon, MauvaisType, type;
  19.  
  20.     //Choisie au hazard le nombre sur la carte
  21.     NombreAleatoire = rand()%13;
  22.     // Choisie au hazard le type de carte      
  23.     SorteCarte = static_cast <Type_Sorte_Carte> (rand()%3);
  24.  
  25.     TropHaut = " Le chiffre est trop haut, ";
  26.  
  27.     TropBas = " Le chiffre est trop bas, " ;
  28.  
  29.     Bon = " Le chiffre est bon, " ;
  30.  
  31.     MauvaisType = "Mauvais type de carte " ;
  32.  
  33.  
  34.  
  35.     cout << "Deviner quel est le numero et quel type de carte avec p/c/k/t" << endl;
  36.  
  37.     cin >> type;
  38.     cin >> chiffre;
  39.  
  40.    
  41.    
  42.     Type_Sorte_Carte P = PIQUE;
  43.     Type_Sorte_Carte C = COEUR;
  44.     Type_Sorte_Carte K = CARREAU;
  45.     Type_Sorte_Carte T = TREFLE;
  46.  
  47.     if(isupper(type[0]))
  48.     {
  49.         return 0;
  50.     }
  51.     else
  52.     {
  53.         type[0] = toupper(type[0]);
  54.  
  55.         return type[0];
  56.     }
  57.  
  58.  
  59.  
  60.     while (chiffre != NombreAleatoire && type[0] != SorteCarte)
  61.     {
  62.         if ( chiffre == NombreAleatoire)
  63.         {
  64.             if(type[0] == SorteCarte)
  65.             {
  66.                 cout  << Bon << "et vous avez le bon type! " <<  endl;
  67.        
  68.             }
  69.             else if ( type[0] != SorteCarte)
  70.             {
  71.                 cout  << Bon << MauvaisType <<  endl;
  72.             }
  73.  
  74.  
  75.        
  76.         }
  77.         else if ( chiffre <= NombreAleatoire)
  78.         {
  79.             if(type[0] == SorteCarte)
  80.             {
  81.                 cout  << TropBas << "et vous avez le bon type! " <<  endl;
  82.        
  83.             }
  84.             else if ( type[0] != SorteCarte)
  85.             {
  86.                 cout  << TropBas << MauvaisType <<  endl;
  87.             }
  88.        
  89.         }
  90.  
  91.         else
  92.         {
  93.             if(type[0] == SorteCarte)
  94.             {
  95.                 cout  << TropHaut << "et vous avez le bon type! " <<  endl;
  96.        
  97.             }
  98.             else if ( type[0] != SorteCarte)
  99.             {
  100.                 cout  << TropHaut << MauvaisType <<  endl;
  101.             }
  102.        
  103.         }
  104.     }  
  105.  
  106.  
  107.  
  108.  
  109.    
  110.     }
Add Comment
Please, Sign In to add comment