Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C program street _ fighter.c which allows the user to play a game of Street Fighter. The user should be able to customise
Write a C program streetfighter.c which allows the user to play a game of Street Fighter. The user should be able to customise the attack power and attack keybinding the assignment of a key on a keyboard to a command for each fighter.
Each round, the program should prompt each fighter to attack. It should then print out the current health of each fighter, continuing until one of the fighters has no health remaining. At this point it should print which player won the game.
A fighter who is below of their maximum health deals more damage.
You are provided with struct fighter which contains the following fields:
int attack: The attack power of the fighter. A fighter's attack power will come from the user and will be between and
double health: The current health of the fighter. Fighter's begin with a maximum health of
char attackcommand: The key binding for the attack command.
examples
streetfighter
Welcome to Street Fighter!
Enter Fighter s attack power :
Enter an ascii character for Fighter s attack command: a
Enter Fighter s attack power :
Enter an ascii character for Fighter s attack command: b
FIGHT!
Fighter press a to attack: a
Fighter attacks!
Fighter press b to attack: b
Fighter attacks!
Fighter s health:
Fighter s health:
Fighter press a to attack: a
Fighter attacks!
Fighter press b to attack: b
Fighter attacks!
Fighter s health:
Fighter s health:
Fighter press a to attack: a
Fighter attacks!
Fighter press b to attack: b
Fighter attacks!
Fighter s health:
Fighter s health:
Fighter press a to attack: a
Fighter attacks!
Fighter press b to attack: b
Fighter attacks!
Fighter s health:
Fighter s health:
Fighter press a to attack: a
Fighter attacks!
Fighter press b to attack: b
Fighter attacks!
Fighter s health:
Fighter s health:
Fighter wins!
GAME OVER
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started