Steph3457
je debute en c++ et j'essaye de faire un jeu.
g commencé un petit programme mais lors de la compilation il y a parse error et je ne c pa ce ke ca veu dir
je met mon programme et en dessous le message d'erreur.
merci pour vos conseil.
#include <iostream.h>
int attaqueM(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE);
int attaqueE(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE);
int attaqueP(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE);
int attaque(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE);
void menu(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE);
short att,def,hp,sp,pp,vit,exp,expcombat;
short attE,defE,hpE,vitE,expE;
int combat(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE)
{
int attaque(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE, short vitE, short expE)
{
hpE=hpE-(att+expcombat);
cout<<"hp ennemie="<<hpE<<endl;
if (hpE==0)
{
cout<<"Vous avez gagné";
return 0;
}
else{
attaqueE(att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE);
}
}
int attaqueM(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE)
{
hpE=hpE-(att+expcombat);
cout<<"hp ennemie="<<hpE<<endl;
if (hpE==0){
cout<<"Vous avez gagné";
}
else{
attaqueE(att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE);
}
}
int attaqueP(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE)
{
hpE=hpE-(att+expcombat);
cout<<"hp ennemie="<<hpE<<endl;
if (hpE==0){
cout<<"Vous avez gagné";
}
else{
attaqueE(att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE);
}
}
int attaqueE(short att, short def, short hp, short sp, short pp, short vit, short exp, short expcombat, short attE, short defE, short hpE,short vitE, short expE)
{
hp=hp-attE+expcombat+def;
cout<<"hp="<<hp<<endl;
if (hp==0){
cout<<"vous etes mort";
}
else{
menu(att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE);
}
}
void attaque_magique()
{
cout<<"Choisir une attaque magique"<<endl;
cout<<"1.Feux"<<endl;
cout<<"2.Glace"<<endl;
short int choix1;
cin>>choix1;
switch(choix1)
{
case 1: attaqueM (att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE); break;
case 2: attaqueM (att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE); break;
}
}
void attaque_pouvoir()
{
cout<<"Choisir un pouvoir"<<endl;
cout<<"1.Boule d'energie"<<endl;
cout<<"2.Kamehameha"<<endl;
int choix2;
cin>>choix2;
switch(choix2)
{
case 1: attaqueP (att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE); break;
case 2: attaqueP (att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE); break;
}
}
void menu(short att,short def,short hp,short sp,short pp,short vit,short exp,short expcombat,short attE,short defE,short hpE,short vitE,short expE)
{
cout<<"1.Attaque"<<endl;
cout<<"2.Attaque Magique"<<endl;
cout<<"3.Attaque Pouvoir"<<endl;
int choix;
cin>>choix;
switch (choix)
{
case 1: attaque (att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE); break;
case 2: attaque_magique; break;
case 3: attaque_pouvoir; break;
}
}
}
void main()
{short att=100;short def=100;short hp=1000;short sp=100;short pp=100;short vit=100;short exp=100;short expcombat=10;
short attE=100;short defE=100;short hpE=1000;short vitE=100;short expE=100;
cout<<"1er combat"<<endl;
combat(att,def,hp,sp,pp,vit,exp,expcombat,attE,defE,hpE,vitE,expE);
}
MESSAGE D'ERREUR:
g++ 1ercombat.cpp -o 1ercombat.exe
1ercombat.cpp: In function `int combat(short int, short int, short int, short int, short int, short int, short int, short int, short int, short int, short int, short int, short int)':
1ercombat.cpp:17: parse error before `{'
1ercombat.cpp: At top level:
1ercombat.cpp:127: parse error before `}'