can anyone help me with this c++ program? its a little much but i would really appreciate it

Project specifications:
Create a 2-player game that utilizes the “a s d f” and “4 5 6 8” keys on your keyboard.
It would be a modified rock, paper, and scissors game, and adapted to be a boxing game. The rules are simple
If both players throw the same kind of punches (both uppercuts, a left or right are both equal) they punch each other
An uppercut is defeated by a right
A right is defeated by a straight
A straight is defeated by a left
A left is defeated by an uppercut
A straight and uppercut hit each other

The controls are the following:
Player 1:
A = Left hook, D = Right hook, S = Uppercut, W = Left Straight
Player 2:
4 = Left hook, 6 = Right hook, 5 = Uppercut, 8 = Left Straight

The game must be able to wait for keyboard presses, check the values, and score it accordingly. Both players must be able to press a key at the same time and it would be stored.

The game would continue until one player is knocked out (implement a delay after each “round”), and each win is worth 10 damage.

Your game must utilize a player structure that will store the player life (100 by default), and store the current action of the player (whether hook, uppercut, etc)

Your program must be modular. That means there must be some functions to make your program shorter.

You must be able to save who won per game into a text file so that each win is recorded. (the win is not the round win, but when the person is knocked out)

You have to show us that you've put some effort into it before anyone will help. What exactly are you having trouble with?

I have made this but it does not work. Hope any of u guys can help me asap.

#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <time.h>

char Player1Menu();
char Player2Menu();

void CheckScore(char player1Choice, char player2Choice, int player1Health, int player2Health);

int main()
{
	//variable declaration
	char player1Choice; 
	char player2Choice; 
	int player1Health = 100;
	int player2Health = 100;

	do 
	{
		player1Choice = Player1Menu();
		player2Choice = Player2Menu();
		CheckScore(player1Choice,player2Choice,player1Health,player2Health);

		
	} while ((player1Health > 0) && (player2Health > 0)); 

	return 0;
}

char Player1Menu()
{
	char MenuChoice;
		cout << "Player 1 Action Menu";
		cout << "(A) Left Hook\n";
		cout << "(D) Right Hook\n";
		cout << "(S) Uppercut\n";
		cout << "(W) Left Straight\n";
	cin >> MenuChoice;
	return MenuChoice;
}


char Player2Menu()
{
	char MenuChoice;
		cout << "Player 2 Action Menu";
		cout << "(4) Left Hook\n";
		cout << "(6) Right Hook\n";
		cout << "(5) Uppercut\n";
		cout << "(8) Left Straight\n";
	cin >> MenuChoice;
	return MenuChoice;
}

void CheckScore(char player1Choice, char player2Choice, int player1Health, int player2Health)
{
	//an uppercut is defeated by a right
	if (player1Choice == "S")
	{
		switch (player2Choice)
		{
			case 4,5,8: player2Health -= 10; break;
			case 6: player1Health -= 10; break;
		}
	}
	
	if (player2Choice == "5")
	{
		switch (player1Choice)
		{
			case 4,5,8: player1Health -= - 10; break;
			case 6: player2Health -= 10; break;
		}
	}
	
	//a right is defeated by a straight
	if (player1Choice == "D")
	{
		switch (player2Choice)
		{	
			case 4,6,5: player2Health -= 10; break;
			case 8: player1Health -= 10; break;
		}
	}

	if (player1Choice == "W")
	{
		switch (player2Choice)
		{
			case 6,5,8: player2Health -= 10; break;
			case 4: player1Health -= 10; break;
		}

	}
}

Here is a version that compiles. I'll let you play around with the logic some more now. I normally compile after each ten lines of code so that I don't have to track down more than one or two issues. Good luck.

#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <time.h>
using namespace std;

char Player1Menu();
char Player2Menu();

void CheckScore(char player1Choice, char player2Choice, int player1Health, int player2Health);

int main()
{
//variable declaration
char player1Choice;
char player2Choice;
int player1Health = 100;
int player2Health = 100;

do
{
player1Choice = Player1Menu();
player2Choice = Player2Menu();
CheckScore(player1Choice,player2Choice,player1Health,player2Health);


} while ((player1Health > 0) && (player2Health > 0));

return 0;
}

char Player1Menu()
{
char MenuChoice;
cout << "Player 1 Action Menu";
cout << "(A) Left Hook\n";
cout << "(D) Right Hook\n";
cout << "(S) Uppercut\n";
cout << "(W) Left Straight\n";
cin >> MenuChoice;
return MenuChoice;
}


char Player2Menu()
{
char MenuChoice;
cout << "Player 2 Action Menu";
cout << "(4) Left Hook\n";
cout << "(6) Right Hook\n";
cout << "(5) Uppercut\n";
cout << "(8) Left Straight\n";
cin >> MenuChoice;
return MenuChoice;
}

void CheckScore(char player1Choice, char player2Choice, int player1Health, int player2Health)
{
//an uppercut is defeated by a right
if (player1Choice == 'S')
{
switch (player2Choice)
{
case '4': player2Health -= 10; break;
case '5': player2Health -= 10; break;
case '8': player2Health -= 10; break;
case '6': player1Health -= 10; break;
}
}

if (player2Choice == '5')
{
switch (player1Choice)
{
case '4': player1Health -= 10; break;
case '5': player1Health -= 10; break;
case '8': player1Health -= 10; break;
case '6': player2Health -= 10; break;
}
}

//a right is defeated by a straight
if (player1Choice == 'D')
{
switch (player2Choice)
{
case '4': player2Health -= 10; break;
case '6': player2Health -= 10; break;
case '5': player2Health -= 10; break;
case '8': player1Health -= 10; break;
}
}

if (player1Choice == 'W')
{
switch (player2Choice)
{
case '6': player2Health -= 10; break;
case '5': player2Health -= 10; break;
case '8': player2Health -= 10; break;
case '4': player1Health -= 10; break;
}
}
}
commented: Why would you 'fix' their code for them then post it completely unformatted! No cool on 2 counts. -2

player1Choice == "S" is wrong. You can't compare a char to a string. Using single quotes instead.
Also you forgot to include using namespace std; , this shouldn't even compile. What compiler are you using?

and next time use code-tags when posting code.

[edit]

@tonymuilenburg: We don't hand out out ready-to-go solutions here. We try to help people by giving them hints to improve their code. Also you code isn't very good, if you don't mind me saying... Want tips?

Oh, I think you mistook Adrian's code for mine. I didn't write the code, Adrian wrote it. I just made a couple of tweaks so that it would compile. If you look at the version I posted, it has both of your suggestions included :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.