OK so here is a fighter game I made..except my fighters power won't decrease and I can't get my fighters names to show up....*sigh*... any idea.. My functions could be wrong.. but I always thought it went above int main()..


Code:
#include<iostream>
using namespace std;
int fighterOne (char fighter1Attack){
string fighter1Name;
// char fighter1Attack; 
int fighter2Power=1000;
string fighter2Name;
cout << fighter1Name << " please choose an attack (P) = Punch, (K) = Kick => ";
cin >> fighter1Attack;
if (fighter1Attack == 'P' || fighter1Attack == 'p') {
fighter2Power -= 50;
cout << fighter2Name << "'s health reduced to " << fighter2Power << endl;
}
else if (fighter1Attack == 'K' || fighter1Attack == 'k') {
fighter2Power -= 100;
cout << fighter2Name << "'s health reduced to " << fighter2Power << endl;
}
else {
cout << "Invalid attack, you lose a turn!" << endl;
}
}
int fighterTwo (char fighter2Attack) {
string fighter2Name;
//char fighter2Attack; 
int fighter1Power=1000;
string fighter1Name;
cout << fighter2Name << " please choose an attack (P) = Punch, (K) = Kick => ";
cin >> fighter2Attack;
if (fighter2Attack == 'P' || fighter2Attack == 'p') {
fighter1Power -= 50;
}
else if (fighter2Attack == 'K' || fighter2Attack == 'k') {
fighter1Power -= 100;
cout << fighter1Name << "'s health reduced to " << fighter1Power << endl;
}
else {
cout << "Invalid attack, you lose a turn!" << endl;
}
}
int main() {
string fighter1Name = "Greg"; 
string fighter2Name = "Casey"; 
int fighter1Power = 1000; 
int fighter2Power = 1000; 
char fighter1Attack;
char fighter2Attack;
 
do {
fighterOne (fighter1Attack);
fighterTwo (fighter2Attack);
}while((fighter1Power > 0) && (fighter2Power > 0));
if (fighter1Power > fighter2Power) {
cout << "Fighter 1 is the winner!" << endl;
}
else if (fighter2Power > fighter1Power) {
cout << "Fighter 2 is the winner!" << endl;
}
else {
cout << "The game ended in a draw!" << endl;
}
return 0;
}