Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The C Programming Assignment is as follows... Must create at least four function

ID: 3632786 • Letter: T

Question

The C Programming Assignment is as follows... Must create at
least four functions (including main).

You can have many more functions if you want. The program is to generate a
puzzle search game SHEET ONLY.

The program will input between 1 and 16 words. The program will create a
word search puzzle such as follows:

1234567890123456789012345678901234567890123456789012345678901234567890

01. COMMITMENTAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYSQEREQTAW
02. HOCKEYSUPPOYOUNEVERKNOWDEARHOWMUCHI LOVE YOUSOPLEASEDONTTAKEMYAPPLEPIE
03. DISNEYRIDELIGAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGRREDDOGGY
04. ASTROASTRORAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYGEENAPPL
05. HARRYPORTERRAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREHOCKEYCP
06. LATENIGHTTVTAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREPENGUINS
07. VALUEROOMSSAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYPIRATESS
08. APPLEYOUAREMHOMESHOMESYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYSWHITEAAA
09. APPLEYOUAREMYSUNSHINEYOUDRYDRYDRYDRYAKEMEHAPPYWHENSKIESAREGREYBLUEBBCV
10. APPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYSEASONSEASONWHENSKIESAREGREGREENGGG
11. APPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREFLOODINGFLOOGREGREENGGG
12. LEYOUAREMYSUNSHINERIVERRIVERRIVYOUMAKEMEHAPPYWHENSKIESAREGREYSGREENGGG
13. PPLEYOUAREMYSUNSHINEYMAGICMAGICOUMAKEMEHAPPYWHENSKIESAREGREYSGREENGSSS
14. APPLEYOUAREMYSUNSHINEYOUMAKEMEHWINDWINDWIAPPYWHENSKIESAREGREYSGREENZAG
15. APPLEYOUAAAAAAAAAAARBBYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYSGREENXXG
16. APPLEYOUAREMYSUNSHINEYOBBBBBRBBBBUMAKEMEHAPPYWHENSKIESAREGREYSGREENGYG
17. APPLEYOUAREMYSUNSHINEYOUMAKEMEHABBBBBBBBBBPPYWHENSKIESAREGREYSGREENGGG
18. APPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKICCDAEAEAQQESAREGREYSGREENRGG
19. PPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREGEADESSESEEYSGREENGGG
20. PPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGRADGAGASEASEEYSGREENWGG
21. HARRYPORTERRAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREGREENGGG
22. LATENIGHTTVTAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREGREENQGG
23. VALUEROOMSSAPPLEYOUAREMYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYGREENGGG
24. APPLEYOUAREMHOMESHOMESYSUNSHINEYOUMAKEMEHAPPYWHENSKIESAREGREYSGREENGEG
25. APPLEYOUAREMYSUNSHINEYOUDRYDRYDRYDRYAKEMEHAPPYWHENSKIESAREGREYGREENGGR

(no need to show line numbers in the final code)


You are to generate 70 letters in a row and 25 rows. You are to randomly place
the words into the grid. The words can be placed in one of eight directions.
You must allow for the words to cross each other.

Once the 1 to 16 words have been placed into the grid you are to fill in the
remaining places with other letters. Once you have the grid completed
(all words entered and all spaces filled in), you are to create a list of
the 1 to 16 words under the grid in two columns in alphabetical order.

The output needs to go to the screen and to a text file. Please remember
this program is not playing a game only building a hardcopy word search puzzle.

The code so far, just need help finishing the project, don't know how to get our words to randomly pick a spot on the grid and to display and check to see that its not going to fall off the grid. Thanks for any and all help you can attribute.

J.J.

    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include <string.h>
    
    void makeUpper (char *s);
    void menu (void);
    int numberGenerator(int min, int max);
    char characterGenerator(void);
    
    main() {
    int i = 0, i2 = 0, j = 0, wordcount = 0, cancel = 0, run = 1, posx = 0, posy = 0, pass = 0, direction = 0;
    char temp[50], words[10][16], puzzle[25][70], condition;
    
    do {
    
    system("cls");
    menu();
    
    scanf("%c", &condition);
    condition = toupper(condition);
    
    switch (condition)
    {
    case 'A'://ENTER UPTO 16 WORDS
    system("cls");
    do {
    printf("Enter a new word to add to the puzzle <S to Stop>: ");
    scanf("%s", &temp);
    makeUpper(temp);
    if(temp[0] == 83 && temp[1] == 0)
    {
    system("cls");
    cancel = 1; //If the user enters "S", then cancel them out
    if (i < 1)
    {
    printf("That is not enough. You must enter atleast one word. Fool. ");
    cancel = 0;
    }
    }
    else
    {
    if(strlen(temp) <= 10)
    {
    for(i2 = 0; i2 <= strlen(temp); i2++) //Add the word to the array
    {words[i][i2] = temp[i2];}
    i++;
    wordcount++;
    if (i > 16)
    {
    cancel = 1;
    printf("That is enough. You have entered more than 16 words... Genius ");
    system("pause");
    }
    }
    else{printf("Word must be 10 letters or less. ");} //If the word is more than 10 letters
    }
    } while(cancel != 1);
    break;
    
    case 'B': //DISPLAY CROSSWORD
    //Grid Entry Position Generation
    do
    {
    posx = numberGenerator(0,69);
    posy = numberGenerator(0,24);
    if (puzzle[posx][posy] != ' ')
    {pass = 1;}
    }while(pass == 0);
    
    /*Direction Randomizer
    UP - 1 UP-RIGHT - 2 RIGHT - 3 DOWN-RIGHT - 4
      DOWN - 5 DOWN-LEFT - 6 LEFT - 7 UP-LEFT - 8
      */
    direction = numberGenerator(0,7);
    
    switch (direction)
    {
    case 0:
    break;
    case 1:
    break;
    case 2:
    break;
    case 3:
    break;
    case 4:
    break;
    case 5:
    break;
    case 6:
    break;
    case 7:
    break;
    }
    
    for (i = 0; i < 25; i++)
    {
    for (j = 0; j < 70; j++)
    {
    puzzle[i][j] = ' ';
    printf("%c", puzzle[i][j]);
    }
    printf(" ");
    }
    system("pause");
    break;
    
    case 'C': //EXPORT TO FILE
    if (wordcount > 8)
    {
    for (i = 0; i < 16; i++)
    {
    for (j = 0; j < 10; j++)
    {
    printf("%c", words[i][j]);
    }
    printf(" ");
    }
    }
    break;
    
    case 'D': //EXIT
    run = 0;
    break;
    }
    }while (run == 1);
    }
    
    void menu(void)
    {
    printf("########################################################## ");
    printf("# CROSSWORD PUZZLE # ");
    printf("# BY: Johnny # ");
    printf("########################################################## ");
    printf("# # ");
    printf("# A) Enter upto 16 words to create puzzle # ");
    printf("# # ");
    printf("# B) Display crossword. # ");
    printf("# # ");
    printf("# C) Export to file. # ");
    printf("# # ");
    printf("# D) Quit # ");
    printf("# # ");
    printf("########################################################## ");
    }
    
    void makeUpper(char *s)//Function that makes all characters uppercase in any string
    {
    char *p;
    for (p = s; *p != ''; p++)
    {
    *p = (char) toupper(*p);
    }
    }
    
    char characterGenerator(void)
    {
    char c;
    srand( (unsigned int) time(NULL));
    c = (rand() % 26) + 'a';
    c = toupper(c);
    return c;
    }
    
    
    int numberGenerator(int min, int max)
    {
    static int Init = 0;
    int rc;
    if (Init == 0)
    {
    srand(time(NULL));
    Init = 1;
    }
    rc = (rand() % (max - min + 1) + min);
    return (rc);
    }

Explanation / Answer

#include #include #include #include #include // GLOBAL VARIABLES int a[5][5]; int t[16]={0,4,11,12,7,1,15,5,13,6,10,3,2,14,8,9}; int test[16]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; struct pos { int h,v; }p[4][4]; int row=4,col=4; // FUNCTION PROTOTYPES void game(int); //MOVEMENT void rec(); //DRAWING RECTANGLE void pri(); //PRINTING NUMBERS INITIALLY int getkey(); // TO TRACE KEY PRESSED inline void space() { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote