diff options
Diffstat (limited to '')
| -rw-r--r-- | include/utils.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/include/utils.h b/include/utils.h index 74c0ca1..08895c0 100644 --- a/include/utils.h +++ b/include/utils.h | |||
| @@ -1,8 +1,30 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | |||
| 3 | #include <stdbool.h> | ||
| 2 | #include <stddef.h> | 4 | #include <stddef.h> |
| 3 | 5 | ||
| 6 | /** Print a horizontal separator line */ | ||
| 4 | void print_line(void); | 7 | void print_line(void); |
| 5 | void wait_enter(const char *msg); | 8 | |
| 6 | char ask_yes_no(const char *msg); | 9 | /** Pause until the user presses ENTER */ |
| 7 | void now_str(char *buf, size_t size); | 10 | void wait_for_enter(const char* prompt); |
| 8 | size_t rand_index(size_t max); | 11 | |
| 12 | /** Ask a yes/no question and return boolean */ | ||
| 13 | bool ask_yes_no(const char* prompt); | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Get the current timestamp for recording when a question was answered | ||
| 17 | * | ||
| 18 | * @param answer_time_buffer Buffer to store the formatted timestamp | ||
| 19 | * @param buffer_capacity Size of the buffer in bytes | ||
| 20 | */ | ||
| 21 | void get_answer_timestamp(char* answer_time_buffer, size_t buffer_capacity); | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Get a random question index in the quiz (thread-safe) | ||
| 25 | * | ||
| 26 | * @param seed Pointer to an unsigned int seed (per-thread) | ||
| 27 | * @param total_questions Number of questions in the current quiz session | ||
| 28 | * @return Random index in the range [0, total_questions-1] | ||
| 29 | */ | ||
| 30 | size_t get_random_question_index(unsigned int* seed, size_t total_questions); | ||
