You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
XiaoMāo edited this page Oct 15, 2026
·
1 revision
Number-Guessing-Game
Type: Bro Code course project
Date: Sept 2026
Concepts:rand(), srand(time(NULL)), do-while, tracking state across iterations
What it does
Generates a random number from 1 to 100 and lets the user guess it, with too-high / too-low feedback and a tries counter.
What I learned
This was the first bug I found and fixed myself: my random-range formula could produce values outside 1 to 100. After fixing it I traced the math and realized the fix only worked because min was 1. The general version is min + rand() % (max - min + 1). The lesson is to test edge cases, not just the happy path.