This is a beginner-friendly command-line Geography Quiz built in C, focusing on the following goals:
- All control flow is implemented using
whileloops and if/else logic, as well as one function only. - No usage of:
gotostatementsswitchstatementsdo-whileloopsforloops
- Contains 3 main questions about geography
- Each correct answer awards 10 points
- Question 3 grants 5 bonus points if the userβs guess is close to the correct answer
- Passing mark is 15 out of 30
- If the user scores full marks (30), they unlock a bonus question for a prize!! (just kidding no prize π)
- Handles:
- Input validation
- Retrying incorrect answers (only one extra try per question)
- Displaying running scores
- Clean separation of logic into functions (e.g.
result())
- Displays instructions and quiz rules
- Loops through 3 questions
- For each question:
- User inputs an answer
- Program validates the input
- Scores are calculated
- Displays final score after finishing the quiz:
- If user passes (minimally 15/30): offers to retry
- If user fails (below 15/30): prompts to try again
- If user scores full marks (30/30): unlocks a bonus question
- Bonus question asks a 4th geographical question
Geography Quiz.cβ Main quiz logic- Uses standard C library (
stdio.h) only
- Go to Code::Blocks
- Select "IDE"
- Copy-paste the code
- Click run
- The interface will run in the console
- Integrate a file system to save high scores
- Add more quiz questions
- Implement a scoring leaderboard
- Use colors for better console UI (if terminal supports it)