Doubt in call by reference function

I have just learnt how to write a function.......

but when I tried to make a two player battle function where each player gets a chance to hit other (just like Pokemon but the second player is your friend and not the computer) I was confused and didn't knew where to start...

Please help

What does this have to do with call by reference?
Do you have any specific question?
yup

format to write a two player battle function where layer 1 strikes first and then player 2 strikes...... this goes on until one of the player dies......
1
2
3
4
5
6
7
8
9
10
//battle
void battle(Player player1, Player player2)
{
	while (!playerWin())
	{
		player1.strike();
		player2.strike();
	}
	cout << "The winner is " << winner() << endl;
}
thank you... But can we use

(Player player1, Player player2)


I thought it was always

(data_type player1,data_type player2)
Topic archived. No new replies allowed.