This is your capstone project! Bring together everything you've learned — variables, functions, loops, conditionals, and control flow — to build a turn-based battle system in C++.
YOUR TASK
Create a battle game where:
The hero starts with 100 HP and the enemy starts with 60 HP
Each turn, the player chooses: 1. Attack or 2. Heal
Attack deals 20 damage to the enemy; the enemy always hits back for 10
Heal restores 15 HP to the hero (no enemy counter-attack)
After each turn, print both HP values
The loop ends when either HP hits 0 — print who wins
Use functions to keep your attack, heal, and display logic clean.
Need a hint?
Structure to follow:
1. Start with int heroHP = 100, enemyHP = 60;
2. Write helper functions: void attack(int& enemyHP, int& heroHP) — subtract 20 from enemy, 10 from hero void heal(int& heroHP) — add 15 to hero HP void showHP(int h, int e) — print both HP values
3. while (heroHP > 0 && enemyHP > 0) loop:
— print the menu, read choice with cin
— call the right function via if/else
— call showHP() after each action
4. After the loop, check who won with an if/else
Console initialized...
Ready for Final Project: RPG Battle System
> Use "Check My Code" to test your battle loop
> Once it passes, hit Complete Course!