Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- #include <cstdlib>
- #include <string>
- using namespace std;
- /*int main ()
- {
- enum Type_Sorte_Carte {PIQUE,COEUR,CARREAU,TREFLE};
- int NombreAleatoire, CarteAleatoire, chiffre;
- Type_Sorte_Carte SorteCarte;
- char Sorte[3];
- string TropHaut, TropBas, Bon, MauvaisType, type;
- //Choisie au hazard le nombre sur la carte
- NombreAleatoire = rand()%13;
- // Choisie au hazard le type de carte
- SorteCarte = static_cast <Type_Sorte_Carte> (rand()%3);
- TropHaut = " Le chiffre est trop haut, ";
- TropBas = " Le chiffre est trop bas, " ;
- Bon = " Le chiffre est bon, " ;
- MauvaisType = "Mauvais type de carte " ;
- cout << "Deviner quel est le numero et quel type de carte avec p/c/k/t" << endl;
- cin >> type;
- cin >> chiffre;
- Type_Sorte_Carte P = PIQUE;
- Type_Sorte_Carte C = COEUR;
- Type_Sorte_Carte K = CARREAU;
- Type_Sorte_Carte T = TREFLE;
- if(isupper(type[0]))
- {
- return 0;
- }
- else
- {
- type[0] = toupper(type[0]);
- return type[0];
- }
- while (chiffre != NombreAleatoire && type[0] != SorteCarte)
- {
- if ( chiffre == NombreAleatoire)
- {
- if(type[0] == SorteCarte)
- {
- cout << Bon << "et vous avez le bon type! " << endl;
- }
- else if ( type[0] != SorteCarte)
- {
- cout << Bon << MauvaisType << endl;
- }
- }
- else if ( chiffre <= NombreAleatoire)
- {
- if(type[0] == SorteCarte)
- {
- cout << TropBas << "et vous avez le bon type! " << endl;
- }
- else if ( type[0] != SorteCarte)
- {
- cout << TropBas << MauvaisType << endl;
- }
- }
- else
- {
- if(type[0] == SorteCarte)
- {
- cout << TropHaut << "et vous avez le bon type! " << endl;
- }
- else if ( type[0] != SorteCarte)
- {
- cout << TropHaut << MauvaisType << endl;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment