0

someone should help me with thisss T-T okay the instruction is like this
"let your prog picks a combination of vowels and consonants. User will then build as much words as possible from the chosen letters. your prog will check the correctness of the words. give points to each word built, with higher point given to words that use all the letters. user may continue with the game. Show the total points collected. you may limit the number of letters to 4 or 5 letters. you may add level of difficulties by the number of letters user chooses to work with, i.e. 5 letters is given more points than 4 letters."
so this is my beginning part but there's some errors and idk how to fix it. please help me. i really need a help on this.

#include <stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
#include<ctype.h>

void Question(int);
void PrintLine();
void Menu();
void Easy();
void Medium();
void Hard();
void Compareone(char[50][10],char[30][10]);
void CompareTwo(char[50][10],char[30][10]);
void CompareThree(char[50][10],char[30][10]);

char AnslistOne[30][10] = { "horse","shore","her","shoe","sore","hero","rose","so","hose","she","he","hoe","peach","cheap","cap","pace","hap","chap","ape","heap","pec","ache" };
char AnslistTwo[30][10]= { "wodge","dew","go","do","wed","dog","god","woe","doe","ode","cove","vet","veto","cot","cote","vote","evo","toe","covet" };
char AnslistThree[30][10]= { "pooch","hoop","hop","cop","coop","poo","poco","chop","anime","amine","mine","name","mean","in","am","man","men","him","min" };
char cont,Ans[50][10];
int level,num,i,v;
int main ()
{
    char name[50];
    system("color 05");
    PrintLine();
    printf("\n\t\t\tWelcome to Boggles\t\n");
    PrintLine();
    system("title Word Construction Game");

    printf("\t\t\tEnter name: "); //input user's name
    gets(name);


    do
    {
        system("cls");
        system("color 80"); 
        Menu();
        printf("\n\nHi %s, please select difficulty (1-3) :",name); //asking user to select the level of difficulty
        scanf(" %c",&level);
        Question(level);
        while( level == 1 && level == 2 && level == 3 )
        {
            printf("Sorry. we only have level 1 to level 3 only. Please re-enter: ");
            scanf(" %c",&level);
            Question(level);
        }
        printf("\n\nDo you want to continue? (Y-yes|N-no)"); //asking user to continue or not
        scanf(" %c", &cont);
        while(cont!='y'&&cont!='Y'&&cont!='n'&&cont!='N')
           {
              fflush(stdin);
              printf("Invalid input. Please re-enter. (Y-yes|N-no)");
              scanf(" %c", &cont);
           }        
    }while(cont=='y'||cont=='Y');



    system("pause");
    return 0;

}
void PrintLine ()
{
    printf("\n\t\t=======================================\n");
    return;
}
void Menu()
{
    printf("Level 1 - Easy\n");
    printf("Level 2 - Medium\n");
    printf("Level 3 - Hard\n");

}
void Question(level)
{
    switch (level)
    {
        case 1: Easy();
                break;
        case 2: Medium();
                break;
        case 3: Hard();
                break;                  

    }
}
void Easy()
{
       srand(time(NULL)); //to get random question

       int num = rand() % (2);
       switch(num)
       {
        case 1 : printf("\n\nConstruct as much word as you can from the letters below:\n");
                 printf("S E R O\n\n");
                 printf("Answers : \n");
                 scanf("%s",&Ans[50][10]); //user can enter as much words as they want
                 break;
        case 2 : printf("\n\nConstruct as much word as you can from the letters below:\n");
                 printf("E C H A P\n\n");
                 printf("Answers : \n");
                 scanf("%s",&Ans[50][10]); //user can enter as much words as they want
                 break;                  
       }
       CompareOne(Ans[50][10],AnslistOne[30][10]);
}
void Medium()
{
       srand(time(NULL)); //to get random question

       int num = rand() % (2);
       switch(num)
       {
        case 1 : printf("\n\nConstruct as much word as you can from the letters below:\n");
                 printf("D W O E G\n\n");
                 printf("Answers : \n");
                 scanf("%s",&Ans[50][10]); //user can enter as much words as they want
                 break;
        case 2 : printf("\n\nConstruct as much word as you can from the letters below:\n");
                 printf("V C T O E\n\n");
                 printf("Answers : \n");
                 scanf("%s",&Ans[50][10]); //user can enter as much words as they want
                 break;                  
       }
       CompareTwo(Ans[50][10],AnslistTwo[30][10]);
}
void Hard()
{
       srand(time(NULL)); //to get random question

       int num = rand() % (2);
       switch(num)
       {
        case 1 : printf("\n\nConstruct as much word as you can from the letters below:\n");
                 printf("O C O H P\n\n");
                 printf("Answers : \n");
                 scanf("%s",&Ans[50][10]); //user can enter as much words as they want
                 break;
        case 2 : printf("\n\nConstruct as much word as you can from the letters below:\n");
                 printf("M N E I A\n\n");
                 printf("Answers : \n");
                 scanf("%s",&Ans[50][10]); //user can enter as much words as they want
                 break;                  
       }
      CompareThree(Ans[50][10],AnslistThree[30][10]);
}
void CompareOne(char Ans[50][10],char AnslistOne[30][10])
{
    for (i=0;i<50;i++) //to check for the correctness of the word entered
    {
        if ((strcmpi(Ans[i],AnslistOne[30]))==0)
           printf("CORRECT! ^_^\n");
        else 
           printf("OOPS, SORRY! WORD NOT IN MY LIST\n");
    }
}
void CompareTwo (char Ans[50][10],char AnslistTwo[30][10])
{
    for (i=0;i<50;i++)  //to check for the correctness of the word entered
    {
        if ((strcmpi(Ans[i],AnslistTwo[30]))==0)
           printf("CORRECT! ^_^\n");
        else 
           printf("OOPS, SORRY! WORD NOT IN MY LIST\n");
    }   
}
void CompareThree (char Ans[50][10],char AnslistThree[30][10])
{
    for (i=0;i<50;i++) //to check for the correctness of the word entered
    {
        if ((strcmpi(Ans[i],AnslistThree[30]))==0)
           printf("CORRECT! ^_^\n");
        else 
           printf("OOPS, SORRY! WORD NOT IN MY LIST\n");
    }   
}
1
Contributor
1
Reply
10
Views
1 Year
Discussion Span
Last Post by prgmmgbgnnr
0

my program is almost finished but how can i randomly pick the question for the user ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.