Before we dive deep into the syntax of the
if statement, let’s do a demo!
Here, we have coinflip.cpp program that simulates a coin toss:
- 50% of the time, it’s Heads.
- 50% of the time, it’s Tails.
Run the program 5 times to see an
else statement in action!
How many times did it go Heads?