-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jeu_labyrinthe.cpp
75 lines (65 loc) · 1.16 KB
/
Jeu_labyrinthe.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Jeu_labyrinthe.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Labyrinthe.h"
#include <iostream>
#include <string.h>
void main()
{
char name[20];
char cmd[6];
int score;
char *q;
q=name;
cout<<"Donner le nom de votre heros : ";
cin>>name;
cout<<"Donner les points de vie initiales de "<<name<<" : ";
cin>>score;
Labyrinthe l(score,q);
l.emplacement();
while(!l.fin())
{
cout<<"> ";
cin>>cmd;
if(strcmp(cmd,"nord")==0)
{
l.deplacement(nord);
l.emplacement();
}
else
{
if(strcmp(cmd,"sud")==0)
{
l.deplacement(sud);
l.emplacement();
}
else
{
if(strcmp(cmd,"est")==0)
{
l.deplacement(est);
l.emplacement();
}
else
{
if(strcmp(cmd,"ouest")==0)
{
l.deplacement(ouest);
l.emplacement();
}
else
cout<<"commande incorrecte"<<endl;
}
}
}
}
if(l.gagner())
cout<<endl<<"*****Felicitations! vous avez trouvez la sortie****"<<endl;
else
{
if(l.dans_trappe())
cout<<endl<<"****Vous etes coinces dans une trappe !!*****"<<endl;
else
cout<<endl<<"***Dommage ! vous avez perdu***"<<endl;
}
}