Name: Aku 2009-01-03 15:51
#ifndef RPKEIK_H
#define RPKEIK_H
#include <cstdlib>
#include <iostream>
#include <string>
//using namespace std ;
class RPKeik
{
public :
RPKeik() ;
~RPKeik() ;
void ChoixJoueur1() ;
void ChoixJoueur2() ;
void Combat() ;
private :
int Joueur1 ;
int Joueur2 ;
string NomJoueur1 ;
int VieJoueur1 ;
int AttaqueJoueur1 ;
string NomAttaque1Joueur1 ;
int Attaque1Joueur1 ;
string NomAttaque2Joueur1 ;
int Attaque2Joueur1 ;
string NomJoueur2 ;
int VieJoueur2 ;
int AttaqueJoueur2 ;
string NomAttaque1Joueur2 ;
int Attaque1Joueur2 ;
string NomAttaque2Joueur2 ;
int Attaque2Joueur2 ;
} ;
RPKeik Joueur12 ;
void RPKeik::ChoixJoueur1()
{
cin >> Joueur1 ;
switch (Joueur1)
{
case 1 : this->NomJoueur1="Sorel" ;
this->NomAttaque1Joueur1="1, 2, 3 Sorel" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Sorel & Hardy" ;
this->Attaque2Joueur1=60 ;
break ;
case 2 : this->NomJoueur1="Pikachu" ;
this->NomAttaque1Joueur1="Tonnerre" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Vive-Attaque" ;
this->Attaque2Joueur1=60 ;
break ;
case 3 : this->NomJoueur1="Vegeta" ;
this->NomAttaque1Joueur1="Final Flash" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="It's over 9000 !!!" ;
this->Attaque2Joueur1=60 ;
break ;
case 4 : this->NomJoueur1="Mario" ;
this->NomAttaque1Joueur1="Saut" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Marteau" ;
this->Attaque2Joueur1=60 ;
break ;
case 5 : this->NomJoueur1="Ryu" ;
this->NomAttaque1Joueur1="Hado Ken" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Sho Ryu Ken" ;
this->Attaque2Joueur1=60 ;
break ;
case 6 : this->NomJoueur1="Captain Falcon" ;
this->NomAttaque1Joueur1="Falcon Punch" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Falcon Kick" ;
this->Attaque2Joueur1=60 ;
break ;
case 7 : this->NomJoueur1="Dark_Vador" ;
this->NomAttaque1Joueur1="Je suis ton père" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Sabre Laser" ;
this->Attaque2Joueur1=60 ;
break ;
case 8 : this->NomJoueur1="Windows" ;
this->NomAttaque1Joueur1="BSOD" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Bug" ;
this->Attaque2Joueur1=60 ;
break ;
case 9 : this->NomJoueur1="Joker" ;
this->NomAttaque1Joueur1="Pencil Trick" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Why so serious ?" ;
this->Attaque2Joueur1=60 ;
break ;
case 10 : this->NomJoueur1="Leonidas" ;
this->NomAttaque1Joueur1="This is Sparta !" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="We dine on hell !" ;
this->Attaque2Joueur1=60 ;
break ;
default : cout << "Veuillez selectionner un personnage existant !" << endl ;
break ;
}
}
void RPKeik::ChoixJoueur2()
{
cin >> Joueur2 ;
switch (Joueur2)
{
case 1 : this->NomJoueur2="Sorel" ;
this->NomAttaque1Joueur2="1, 2, 3 Sorel" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Sorel & Hardy" ;
this->Attaque2Joueur2=60 ;
break ;
case 2 : this->NomJoueur2="Pikachu" ;
this->NomAttaque1Joueur2="Tonnerre" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Vive-Attaque" ;
this->Attaque2Joueur2=60 ;
break ;
case 3 : this->NomJoueur2="Vegeta" ;
this->NomAttaque1Joueur2="Final Flash" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="It's over 9000 !!!" ;
this->Attaque2Joueur2=60 ;
break ;
case 4 : this->NomJoueur2="Mario" ;
this->NomAttaque1Joueur2="Saut" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Marteau" ;
this->Attaque2Joueur2=60 ;
break ;
case 5 : this->NomJoueur2="Ryu" ;
this->NomAttaque1Joueur2="Hado Ken" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Sho Ryu Ken" ;
this->Attaque2Joueur2=60 ;
break ;
case 6 : this->NomJoueur2="Captain Falcon" ;
this->NomAttaque1Joueur1="Falcon Punch" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Falcon Kick" ;
this->Attaque2Joueur2=60 ;
break ;
case 7 : this->NomJoueur2="Dark_Vador" ;
this->NomAttaque1Joueur2="Je suis ton père" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Sabre Laser" ;
this->Attaque2Joueur2=60 ;
break ;
case 8 : this->NomJoueur2="Windows" ;
this->NomAttaque1Joueur2="BSOD" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Bug" ;
this->Attaque2Joueur2=60 ;
break ;
case 9 : this->NomJoueur2="Joker" ;
this->NomAttaque1Joueur2="Pencil Trick" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Why so serious ?" ;
this->Attaque2Joueur2=60 ;
break ;
case 10 : this->NomJoueur2="Leonidas" ;
this->NomAttaque1Joueur2="This is Sparta !" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="We dine on hell !" ;
this->Attaque2Joueur2=60 ;
break ;
default : cout << "Veuillez selectionner un personnage existant !" << endl ;
break ;
}
}
void RPKeik::Combat()
{
do
{
cout << "Joueur1 : " << NomJoueur1 << "choisissez une attaque : " << endl << "1." << NomAttaque1Joueur1 << endl << "2." << NomAttaque2Joueur1 << endl ;
cin >> this->AttaqueJoueur1 ;
switch (this->AttaqueJoueur1)
{
case 1 : cout << NomJoueur1 << " lance " << NomAttaque1Joueur1 << endl ;
this->VieJoueur2 = this->VieJoueur2 - this->Attaque1Joueur1 ;
break ;
case 2 : cout << NomJoueur1 << " lance " << NomAttaque2Joueur1 << endl ;
this->VieJoueur2 = this->VieJoueur2 - this->Attaque2Joueur1 ;
break ;
}
cout << NomJoueur2 << " a " << this->VieJoueur2 << " de vie " << endl << endl ;
if (this->VieJoueur2 != 0)
{
cout << "Joueur2 : " << NomJoueur2 << "choisissez une attaque : " << endl << "1." << NomAttaque1Joueur2 << endl << "2." << NomAttaque2Joueur2 << endl ;
cin >> this->AttaqueJoueur2 ;
switch (this->AttaqueJoueur2)
{
case 1 : cout << NomJoueur2 << " lance " << NomAttaque1Joueur2 << endl ;
this->VieJoueur1 = this->VieJoueur1 - this->Attaque1Joueur2 ;
break ;
case 2 : cout << NomJoueur2 << " lance " << NomAttaque2Joueur2 << endl ;
this->VieJoueur1 = this->VieJoueur1 - this->Attaque2Joueur2 ;
break ;
}
cout << NomJoueur1 << " a " << this->VieJoueur1 << " de vie " << endl ;
}
}
while (!(this->VieJoueur1 == 0 || this->VieJoueur2 == 0)) ;
if ( this->VieJoueur2 <= 0 )
{
cout << "Joueur 1 a gagné !" << endl ;
}
else
{
cout << "Joueur 2 a gagné !" << endl ;
}
}
#endif
--------
Errors :
[Linker error] undefined reference to `RPKeik::RPKeik()'
[Linker error] undefined reference to `RPKeik::~RPKeik()'
What can I do to fix this ?
#define RPKEIK_H
#include <cstdlib>
#include <iostream>
#include <string>
//using namespace std ;
class RPKeik
{
public :
RPKeik() ;
~RPKeik() ;
void ChoixJoueur1() ;
void ChoixJoueur2() ;
void Combat() ;
private :
int Joueur1 ;
int Joueur2 ;
string NomJoueur1 ;
int VieJoueur1 ;
int AttaqueJoueur1 ;
string NomAttaque1Joueur1 ;
int Attaque1Joueur1 ;
string NomAttaque2Joueur1 ;
int Attaque2Joueur1 ;
string NomJoueur2 ;
int VieJoueur2 ;
int AttaqueJoueur2 ;
string NomAttaque1Joueur2 ;
int Attaque1Joueur2 ;
string NomAttaque2Joueur2 ;
int Attaque2Joueur2 ;
} ;
RPKeik Joueur12 ;
void RPKeik::ChoixJoueur1()
{
cin >> Joueur1 ;
switch (Joueur1)
{
case 1 : this->NomJoueur1="Sorel" ;
this->NomAttaque1Joueur1="1, 2, 3 Sorel" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Sorel & Hardy" ;
this->Attaque2Joueur1=60 ;
break ;
case 2 : this->NomJoueur1="Pikachu" ;
this->NomAttaque1Joueur1="Tonnerre" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Vive-Attaque" ;
this->Attaque2Joueur1=60 ;
break ;
case 3 : this->NomJoueur1="Vegeta" ;
this->NomAttaque1Joueur1="Final Flash" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="It's over 9000 !!!" ;
this->Attaque2Joueur1=60 ;
break ;
case 4 : this->NomJoueur1="Mario" ;
this->NomAttaque1Joueur1="Saut" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Marteau" ;
this->Attaque2Joueur1=60 ;
break ;
case 5 : this->NomJoueur1="Ryu" ;
this->NomAttaque1Joueur1="Hado Ken" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Sho Ryu Ken" ;
this->Attaque2Joueur1=60 ;
break ;
case 6 : this->NomJoueur1="Captain Falcon" ;
this->NomAttaque1Joueur1="Falcon Punch" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Falcon Kick" ;
this->Attaque2Joueur1=60 ;
break ;
case 7 : this->NomJoueur1="Dark_Vador" ;
this->NomAttaque1Joueur1="Je suis ton père" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Sabre Laser" ;
this->Attaque2Joueur1=60 ;
break ;
case 8 : this->NomJoueur1="Windows" ;
this->NomAttaque1Joueur1="BSOD" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Bug" ;
this->Attaque2Joueur1=60 ;
break ;
case 9 : this->NomJoueur1="Joker" ;
this->NomAttaque1Joueur1="Pencil Trick" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="Why so serious ?" ;
this->Attaque2Joueur1=60 ;
break ;
case 10 : this->NomJoueur1="Leonidas" ;
this->NomAttaque1Joueur1="This is Sparta !" ;
this->Attaque1Joueur1=50 ;
this->NomAttaque2Joueur1="We dine on hell !" ;
this->Attaque2Joueur1=60 ;
break ;
default : cout << "Veuillez selectionner un personnage existant !" << endl ;
break ;
}
}
void RPKeik::ChoixJoueur2()
{
cin >> Joueur2 ;
switch (Joueur2)
{
case 1 : this->NomJoueur2="Sorel" ;
this->NomAttaque1Joueur2="1, 2, 3 Sorel" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Sorel & Hardy" ;
this->Attaque2Joueur2=60 ;
break ;
case 2 : this->NomJoueur2="Pikachu" ;
this->NomAttaque1Joueur2="Tonnerre" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Vive-Attaque" ;
this->Attaque2Joueur2=60 ;
break ;
case 3 : this->NomJoueur2="Vegeta" ;
this->NomAttaque1Joueur2="Final Flash" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="It's over 9000 !!!" ;
this->Attaque2Joueur2=60 ;
break ;
case 4 : this->NomJoueur2="Mario" ;
this->NomAttaque1Joueur2="Saut" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Marteau" ;
this->Attaque2Joueur2=60 ;
break ;
case 5 : this->NomJoueur2="Ryu" ;
this->NomAttaque1Joueur2="Hado Ken" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Sho Ryu Ken" ;
this->Attaque2Joueur2=60 ;
break ;
case 6 : this->NomJoueur2="Captain Falcon" ;
this->NomAttaque1Joueur1="Falcon Punch" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Falcon Kick" ;
this->Attaque2Joueur2=60 ;
break ;
case 7 : this->NomJoueur2="Dark_Vador" ;
this->NomAttaque1Joueur2="Je suis ton père" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Sabre Laser" ;
this->Attaque2Joueur2=60 ;
break ;
case 8 : this->NomJoueur2="Windows" ;
this->NomAttaque1Joueur2="BSOD" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Bug" ;
this->Attaque2Joueur2=60 ;
break ;
case 9 : this->NomJoueur2="Joker" ;
this->NomAttaque1Joueur2="Pencil Trick" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="Why so serious ?" ;
this->Attaque2Joueur2=60 ;
break ;
case 10 : this->NomJoueur2="Leonidas" ;
this->NomAttaque1Joueur2="This is Sparta !" ;
this->Attaque1Joueur2=50 ;
this->NomAttaque2Joueur2="We dine on hell !" ;
this->Attaque2Joueur2=60 ;
break ;
default : cout << "Veuillez selectionner un personnage existant !" << endl ;
break ;
}
}
void RPKeik::Combat()
{
do
{
cout << "Joueur1 : " << NomJoueur1 << "choisissez une attaque : " << endl << "1." << NomAttaque1Joueur1 << endl << "2." << NomAttaque2Joueur1 << endl ;
cin >> this->AttaqueJoueur1 ;
switch (this->AttaqueJoueur1)
{
case 1 : cout << NomJoueur1 << " lance " << NomAttaque1Joueur1 << endl ;
this->VieJoueur2 = this->VieJoueur2 - this->Attaque1Joueur1 ;
break ;
case 2 : cout << NomJoueur1 << " lance " << NomAttaque2Joueur1 << endl ;
this->VieJoueur2 = this->VieJoueur2 - this->Attaque2Joueur1 ;
break ;
}
cout << NomJoueur2 << " a " << this->VieJoueur2 << " de vie " << endl << endl ;
if (this->VieJoueur2 != 0)
{
cout << "Joueur2 : " << NomJoueur2 << "choisissez une attaque : " << endl << "1." << NomAttaque1Joueur2 << endl << "2." << NomAttaque2Joueur2 << endl ;
cin >> this->AttaqueJoueur2 ;
switch (this->AttaqueJoueur2)
{
case 1 : cout << NomJoueur2 << " lance " << NomAttaque1Joueur2 << endl ;
this->VieJoueur1 = this->VieJoueur1 - this->Attaque1Joueur2 ;
break ;
case 2 : cout << NomJoueur2 << " lance " << NomAttaque2Joueur2 << endl ;
this->VieJoueur1 = this->VieJoueur1 - this->Attaque2Joueur2 ;
break ;
}
cout << NomJoueur1 << " a " << this->VieJoueur1 << " de vie " << endl ;
}
}
while (!(this->VieJoueur1 == 0 || this->VieJoueur2 == 0)) ;
if ( this->VieJoueur2 <= 0 )
{
cout << "Joueur 1 a gagné !" << endl ;
}
else
{
cout << "Joueur 2 a gagné !" << endl ;
}
}
#endif
--------
Errors :
[Linker error] undefined reference to `RPKeik::RPKeik()'
[Linker error] undefined reference to `RPKeik::~RPKeik()'
What can I do to fix this ?