C++ > affichage de scores depuis le menu

Titreaffichage de scores depuis le menu
Postée le09-05-2011
Affichée154
Mini-lien
Description

pour jeu de lettres

EtatNe contient pas d'erreurs. Ne contient pas d'erreurs.
Code d'insertion
Options
Afficher les numéros de lignes  Mettre la source en plein ecran  Selectionner la source  Partager sur Facebook 
Téléchargement Telecharger en format txt  Telecharger en format pdf  Telecharger en format cpp
Plein ecran
void chooseLevelHighScores(char userGame)
{

    int totalNbScores = (3*NBSCORES+3);
    int iteration = 0,scoresList[totalNbScores];
    char userLevel, namesList[totalNbScores][TAILLE];
    bool wrongChar;

    cout << "                       CHOIX DU HIGHSCORE (NIVEAU)  " << endl;
    cout << "                    ================================" << endl;
    cout << "                    |                              |" << endl;
    cout << "                    |  1 : Facile                  |" << endl;
    cout << "                    |  2 : Normal                  |" << endl;
    cout << "                    |  3 : Difficile               |" << endl;
    cout << "                    |                              |" << endl;
    cout << "                    ================================" << endl;
    cout << endl;

    do
    {
        if (iteration>0) cout << "Vous avez entre un caractere incorrect." << endl;

        cin >> userLevel;
        userLevel = userLevel - '0';

        if ((userLevel <= 3 and userLevel >=1)and(userGame=='P' or userGame=='p'))
        {
            highScoresCopyHang (namesList,scoresList,totalNbScores,userLevel);
            wrongChar = false;
        }
        else if ((userLevel <= 3 and userLevel >=1)and(userGame=='D' or userGame=='d'))
        {
            highScoresCopyDicho (namesList,scoresList,totalNbScores,userLevel);
            wrongChar = false;
        }
        else wrongChar = true;
        iteration++;
    }
    while(wrongChar);

    printHighScoresGame(namesList,scoresList,userLevel);
}

void chooseHighScores()
{
    int iteration = 0;
    char userGame;
    bool wrongChar;

    printHighScoresASCII();

    cout << "                         CHOIX DU HIGHSCORE (JEU)   " << endl;
    cout << "                    ================================" << endl;
    cout << "                    |                              |" << endl;
    cout << "                    |  P : Pendu                   |" << endl;
    cout << "                    |  H : Dichotomie              |" << endl;
    cout << "                    |                              |" << endl;
    cout << "                    ================================" << endl;
    cout << endl;

    do
    {
        if (iteration>0) cout << "Vous avez entre un caractere incorrect." << endl;

        cin >> userGame;

        if (userGame == 'P' or userGame == 'p' or userGame == 'H' or userGame == 'h')
        {
            chooseLevelHighScores(userGame);
            wrongChar = false;
        }
        else wrongChar = true;
        iteration++;
    }
    while(wrongChar);
}

void getUserMenuChoice(int &difficultyDegree, int &maxLength)
{
    char userChoice, iteration = 0;
bool condition;
    do
    {
        if (iteration>0)
        {
            cout << "Vous avez introduit un mauvais caractere. Recommencez." << endl;
        }
        cin >> userChoice;
        if (userChoice =='p' or userChoice == 'P')
        {
            condition = true;
            printHangManASCII();
            playHangMan(difficultyDegree, maxLength);
        }
        else if (userChoice =='d' or userChoice == 'D')
        {
            condition = true;
            printDichotomyASCII();
            playDichotomy(difficultyDegree, maxLength);
        }
        else if (userChoice == 's' or userChoice == 'S')
        {
            condition = true;
            chooseHighScores();
        }
        else if (userChoice == 'o' or userChoice == 'O')
        {
            condition = true;
            printOptionsASCII();
            printOptions(difficultyDegree, maxLength);
        }
        iteration++;
    }
    while (!condition);
}