Solution: Play with Randomness
This program gives a random compliment each time it runs.
Explanation:
It uses random number generation to pick one of three compliments.
The
srand(time(0))line ensures a different random number each run.Based on the random number (0, 1, or 2), it displays one of the three positive messages like “You’re awesome!” or “Code like a boss!”.
This creates a fun, motivational output that changes every time you execute the program.
Solution: Play with Randomness
This program gives a random compliment each time it runs.
Explanation:
It uses random number generation to pick one of three compliments.
The
srand(time(0))line ensures a different random number each run.Based on the random number (0, 1, or 2), it displays one of the three positive messages like “You’re awesome!” or “Code like a boss!”.
This creates a fun, motivational output that changes every time you execute the program.