I have some quick questions that maybe you could all help me out with.
So, I'm coding his program that needs to read a text file, and write a text file that includes a list of all the unique words that are present in the input text file and displays some word statistics, which include: shortest word, longest word, word length average, and standard deviation.
The program will read a maximum of 50 valid lines from the input file. A valid line is one that contains at least one word. Each line contains a maximum of 50 words, and the maximum length of each word is 20 characters.
My trouble is reading the text into an array without duplicates (or even at all), I'm not sure how to go about doing that, or whether or not it should be multidimensional. It was suggested to maybe do an array such as array[50][50][21] but I was not positive why they chose 3-dimensions.
Any help is greatly appreciated, I can show you examples of inputs and outputs if it would help.
This loop will also test when '== EOF'. I don't think this is what you want. Besides, in standard C, it is possible for the function to have a successful return and still have an error. For example, if you have a bad disk sector on a drive.
Name:
Anonymous2011-07-12 13:50
Ignore this douchefag >>7, and go with C++ instead.
some minor hints:
>>8
Yo homegirl, I'm just following the ANSI/ISO specifications. I know this might seem kind of a radical concept for you to grasp since you work as some monkey IT person at a hick firm.
Name:
Anonymous2011-07-12 13:57
>>8
So now, you want the OP to ditch C in favor of a language that is bloated with objects? Nice job. You're below average.
>>1
Also, if you have any questions to the above code, which is a simple implementation of a linked list, don't be afraid to ask. You might also note that in the worst case (where no words are similar), the run time is O(n2) http://en.wikipedia.org/wiki/Big_O_notation, because every time you add a word you end up traversing the entire list then adding it to the end. It's not that bad if the working set is small and the words repeat a lot. But if you want to go past the scope of your assignment (which you should really finish before experimenting any further), you could try and implement a hash tablehttp://en.wikipedia.org/wiki/Hash_table. Well, good luck!