forked from eamal27/Jeopardy-in-C
-
Notifications
You must be signed in to change notification settings - Fork 0
/
questions.h
51 lines (38 loc) · 1.59 KB
/
questions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Tutorial 4 Jeopardy Project for SOFE 3950U / CSCI 3020U: Operating Systems
*
* Copyright (C) 2015, <Elias Amal, Dominick Mancini, Scott McLean, Luisa Rojas-Garcia>
* All rights reserved.
*
*/
#ifndef QUESTIONS_H_
#define QUESTIONS_H_
#include <stdbool.h>
#define MAX_LEN 256
// List of 3 categories as array of strings
static char categories[3][MAX_LEN] = {"geography", "science", "computer networks"};
// Questions struct for each question
typedef struct {
char category[MAX_LEN];
char question[MAX_LEN];
char answer[MAX_LEN];
int value;
bool answered;
} question;
// An array of 12 questions (4 for each category), initialized in initialize_game
// this may need to be a pointer if you want it set dynamically
extern question questions[12];
// Initializes the array of questions for the game
extern void initialize_game(void);
// Displays each of the remaining categories and question dollar values that have not been answered
extern void display_categories(void);
// Displays the question for the category and dollar value
extern void display_question(char *category, int value);
// Returns true if the answer is correct for the question for that category and dollar value
extern bool valid_answer(char *category, int value, char *answer);
// Returns true if the question has already been answered
extern bool already_answered(char *category, int value);
//marks a question as answered -- This was added by Dominick, since
//I could not find another way to mark a question as answered from Jeopardy.c
extern void question_answered(char *category, int value);
#endif /* QUESTIONS_H_ */