Use a 2D array to read your puzzle from a file. Naturally, every line should be a string, each string being a size-N char array. Assume that, the puzzle cannot exceed 40x40 and assume that the puzzle is always a square. Completely ignore the spaces of any sort. Only pick out the letters from 'A' to 'Z'. Ignore the case of the letter. Turn every letter into its upper-case equivalent.

So, your puzzle string will look like this:

#define MAXROWS 40

#define MAXCOLS 40

char puzzle[MAXROWS][MAXCOLS]

I won't tell you how to define the words array. It is almost the identical idea.

Implement this puzzle search only for the most natural "E" orientation (i.e., words go from left to right and there are no diagonals).

PART B (4 points): Submit as puzzle2.c using Blackboard

Now, improve your program to search for all possible orientations: N, E, W, S, NE, NW, SE, SW.

PART C (1 point + 1 bonus): Submit as puzzlemake.c using Blackboard

Write a program that creates [url removed, login to view] and words.txt.

For this, your puzzlemake.c program should ask the user for two parameters and all of the words:



Words, one by one

Follow these steps to achieve this:

• First, create the [url removed, login to view] file. This is a matter of making a file that contains the words the user just entered ...

• Next, Create a string with so many rows and columns. This 2D array will be identical to the one you are using to read your string in your PART A.

• Fill each individual character with randomized characters ... Do not exceed the 'A' ... 'Z' range, since otherwise it will be invalid characters. To create a random value ranging between 'A' and 'Z', use the C function rand(). This function is contained in the standard C library. I won't tell you where. You have to do this much research to get the bonus points !!!

• Next, pick a random orientation, one of the ones in the list above, and implant every word one by one into your 2D puzzle array.

• Write that array as [url removed, login to view] into the file. This is basically what you will use to test your program with more sophisticated puzzles in PART A, and PART B.

Note : You cannot advance to PART D without completing PART A, B and C.

Notice that, you do not need to complete PART C to be able to finish PART A and PART B, since you can simply use the [url removed, login to view] and words. txt I provided.

PART D (BONUS - 2 points): Submit as puzzle3.c using Blackboard

Now, improve your program so that, it has NO LIMITATION ON THE PUZZLE SIZE and also the PUZZLE CAN BE A RECTANGLE. Call your puzzle size PuzzleRows x PuzzleCols. You have to allocate the memory for the puzzle using malloc() to qualify for the bonus in this question. If you forget to free() the memory you allocated, you will lose bonus points, since your program will be a memory-leaky program. You will read the file [url removed, login to view] and figure out the puzzle size dynamically, and do the puzzle search in every orientation. Notice that, to qualify for the bonus in PART D, you have to submit PART A (puzzle1.c) and PART B (puzzle2.c) and PART C (puzzlemake.c) separately first. This submission on PART D (puzzle3.c) is a completely separate program.

No need to say, to qualify for the bonus PART D points, you have to write a NO-LIMITATION version of your puzzlemake.c. You can write only this version if you are going for PART D bonus points.

Beceriler: C Programlama

Daha fazlasını gör: what is in c programming, what is c# programming, what is c programming, what is a string in programming, what is a library in programming, what is a function in programming, what can you do with programming, the c programming, string search in c, string programming, string library in c, string library c, string in c programming, string c programming, standard programming, standard library c, sort function c, sort array c, search string in c, search string in array, search for programming, search character in string, rectangle line, rand c programming, programming words

İşveren Hakkında:
( 1 değerlendirme ) Rochester, United States

Proje NO: #4403986

1 freelancer is bidding on average $40 for this job


Hi, I would like to do this project please. Let me know if you are interested. Thanks.

in %bids___i_period_sub_35% gün içinde40%project_currencyDetails_sign_sub_37% %project_currencyDetails_code_sub_38%
(31 Değerlendirme)