Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("mode con cols=150 lines=100"); //Non-important code. Used for axi below
printf(" ______ _______ _______ _______ __ _ ___ _______ ___ _______ __ _ \n");
printf("| | | || || || | | || | | || | | || | | |\n");
printf("| _ || ___|| ___|| ___|| |_| || | |_ _|| | | _ || |_| |\n");
printf("| | | || |___ | |___ | |___ | || | | | | | | | | || |\n");
printf("| |_| || ___|| ___|| ___|| _ || | | | | | | |_| || _ |\n");
printf("| || |___ | | | |___ | | | || | | | | | | || | | |\n");
printf("|______| |_______||___| |_______||_| |__||___| |___| |___| |_______||_| |__|\n");
printf("------------------------------------------------------------------------------------\n");
printf("\nIn this game the objective is simple! You will be given a defenition! You must work out the correct word!\nType it in on your keyboard!\n");
printf("\nOne more rule you CANNOT add spaces in it\n");
game();
return 0;}
void game(){
char *words[] = {"Potato", "McDonalds", "Mafia", "Xbox", "Computer", "Star Wars", "HTML", "BBC", "USB", "Watch", "Door", "Window", "Dog", "Obama", "Derby", "College", "BOP", "test1", "test2", "test3`" };
char *questions[] = {"Can be mash or roast", "Best fast food chain", "Italian notirious gang", "Gaming console by Microsoft", "Like a lapotop but a tower", "7 films featuring han solo, luke skywalker etc.", "langauage for programming websites", "Channel 1 on TV", "Portable device we use at college", "Something you wear on your wrist to tell the time", "Use this to get in and out of houses", "You look through these in houses", "A pet that goes ruf ruf", "First African American president of America", "Where we live", "Where we go everyday for torture", "Chicken side", "test1", "test2", "test3"};
char answer[20][255];// Answer array - for more questions increase first bracket
int score =0;
int vec[20] = { 0 };
int i, j, word;
srand(time(NULL));//Function for creating random numbers
for (i = 0; i < 20; i++) {//Creates the position in the array for the defenition
int okay = 0;
while (!okay) {
vec[i] = rand() % 20;//20 is place holder - Increase for more questions
okay = 1;
for (j = 0; j < i; j++) {
if (vec[i] == vec[j]) okay = 0;
}
}
word=vec[i];
printf("%s\n",questions[word]); //print a question
scanf("%s",answer[i]);// wait for the user to type the word
printf("%s\n",answer[i]);// show what the user typed - will be used later!!!!!!!!!!!!!!!!!!!!!!!
printf("\nit was %s\n\n",words[word]);//show the answer
printf("\n\nYour score is %d\n", score);//show the score
}
}
This is the actual code for the score