#include // printf and such #include // calloc(), random() #include // clrsrc() #define QLEN 30 #define QARLEN 5 #define CLEN 30 typedef enum{False,True}bool; typedef struct Competitor { unsigned int answer; /* 0,1,2 */ bool playing; /* Have we used the person ? */ }Competitor; typedef struct Helper { /* Helper is basically the same as Competitor * but it just holds the index number of the player picked * to help us */ unsigned int answer; /* 0,1,2 */ int location; // index }Helper; typedef struct User { long int money; unsigned int answer; // dunno, could be more.. }User; typedef struct Question { char *QuestStr; unsigned int picked; /* The only reason I'm using unsigned * int is to "save space" */ unsigned int answer; }Question; unsigned int pickA(); int pickQ(); void PickTwoPersons(unsigned int answer, Competitor *src, Helper *target); void main() { int i = 0; Question q[QARLEN]; Competitor Players[CLEN]; Helper Helpers[2]; User u; // Clean the screen nicely clrscr(); /* too lazy to write an init function * writing it here.. */ printf("Q/Answers board\n"); for (i = 0;i < 5;i++) // Initialize the array { q[i].QuestStr = (char *)calloc(sizeof(char),QLEN); // Calloc zeroes the array out, and does the same as malloc q[i].picked = 0; // We haven't picked this one yet q[i].answer = pickA(); // I'm only printing it nicely, ignore that ((i+1)%3) ? printf("%4u",q[i].answer) : printf("%4u\n",q[i].answer); } puts("\n"); // two newlines.. for(i=0;i