Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // la boite du gobelin.cpp : définit le point d'entrée pour l'application console.
- //
- #include "stdafx.h"
- #include "iostream"
- #include "time.h"
- #define MAX 5
- using namespace std;
- int choix2(int [MAX][MAX], int [MAX][MAX], int cible);
- void initialiseTableau(int tableau[MAX][MAX], bool utiliseCompteur);
- void afficheTableau(int tableau[MAX][MAX]);
- void cache(int tableauCache[MAX][MAX]);
- void main()
- {
- time_t seconds;
- time(&seconds);
- srand((unsigned int)seconds);
- int chiffreExiste;
- int tableauChiffre[MAX][MAX];
- int tableauCache[MAX][MAX];
- int cibleTir;
- int essai = 3;
- int choix;
- system("cls");
- cout << "apres un combat ereintant" << endl;
- cout << "vous vous assoyez pres du cadavre du gobelin" << endl;
- cout << "vous appercevez son sac" << endl;
- cout << "en fouillant dedans vous trouvez une boites mystérieuse" << endl;
- cout << "elle est ornée d'une série de nombres ainsi que de trois runes émettant une lumiere bleu" << endl;
- system("pause");
- system("cls");
- do
- {
- if (essai > 0)
- {
- system("cls");
- cout << "les runes emettent de la lumiere";
- if (essai == 3)
- {
- cout << " | | | " << endl;
- }
- if (essai == 2)
- {
- cout << " | | " << endl;
- }
- if (essai == 1)
- {
- cout << " | " << endl;
- }
- afficheTableau(tableauChiffre);
- cout << "sur quel nombre appuyez vous" << endl;
- cin >> cibleTir;
- choix = choix2(tableauChiffre, tableauCache, cibleTir);
- system("cls");
- if (choix = 1)
- {
- cout << "la boite s'ouvre laissant voir un anneau verdatre" << endl;
- cout << "en mettant cer anneau au doight, vous redevenez vous-même" << endl;
- cout << "en repensant au gobelin, vous remarquex qur vos mains prennent ne teinte verdatre" << endl;
- cout << "pris de panique, vous repensez a vos belle mains roses et elles reprennent leur forme" << endl;
- cout << "on dirait bien que vous avez trouver un anneau de transformation en gobelin" << endl;
- cout << "petit veinard" << endl;
- }
- else if (choix = 0)
- {
- if (essai == 3)
- {
- cout << "votre peau devient verdatre" << endl;
- }
- else if (essai == 2)
- {
- cout << "vos oreilles se transforment en longues oreilles pendante" << endl;
- cout << "et des crocs appareissent dans votre bouche" << endl;
- }
- else if (essai == 1)
- {
- cout << "vous finalissez votre transformation en gobelin" << endl;
- cout << "vos instincts de gobelin prennent le dessus et vous vous cachez" << endl;
- cout << "ainsi prend fin votre aventure" << endl;
- }
- essai--;
- }
- else
- cout << "mauvais nombre, reessayez" << endl;
- system("pause");
- }
- system("pause");
- main();
- }
- while (essai > 0);
- system("pause");
- }
- int choix2(int tableauChiffre[MAX][MAX], int tableauCache[MAX][MAX], int cible)
- {
- bool chiffreExiste;
- chiffreExiste = false;
- for (int x = 0; x < MAX; x++)
- {
- for (int y = 0; y < MAX; y++)
- {
- if (tableau[x][y] == cible)
- {
- chiffreExiste = true;
- tableau[x][y] = 0;
- if (tableauCache[x][y] == 1)
- return 1;
- }
- }
- }
- if (chiffreExiste == false)
- {
- return -1;
- }
- else
- {
- return 0;
- }
- }
- void cache(int tableauCache[MAX][MAX])
- {
- int randX;
- int randY;
- randX = rand() % MAX;
- randY = rand() % MAX;
- tableau[randX][randY] = 1;
- }
- void initialiseTableau(int tableau[MAX][MAX], bool utiliseCompteur)
- {
- int compteur, valeurInitialisation;
- compteur = 1;
- valeurInitialisation = 0;
- for (int x = 0; x < MAX; x++)
- {
- for (int y = 0; y < MAX; y++)
- {
- if (utiliseCompteur == false)
- {
- tableau[x][y] = valeurInitialisation;
- }
- else
- {
- tableau[x][y] = compteur;
- compteur++;
- }
- }
- }
- }
- void afficheTableau(int tableau[MAX][MAX])
- {
- for (int x = 0; x < MAX; x++)
- {
- for (int y = 0; y < MAX; y++)
- {
- if (tableau[x][y] == 0)
- {
- cout << " ";
- }
- else
- {
- if (tableau[x][y] < 10)
- {
- cout << " ";
- }
- cout << tableau[x][y];
- cout << " ";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement