Archived

This topic is now archived and is closed to further replies.

NashuNatta

Help me understand please?

Recommended Posts

About 6 months ago in May, I attended a local programing compition for my school. I was fairly new to C++ which was the language that our school used for the competion. One of the kids on the team was far to smart to be coding in such amatuere competions (he is now at MIT for college) and he helped us win. There were 10 problems to do in 4 hours and we got them all done except one. The thing is I want to be able to compete this May so I was reviewing some of the questions and decided to try the only one that we didnt finish, but I realy dont know how to do any it! I mean, I know what the psuedo-code is, but how to implement it is a mystery to me. Here is the problem I am working on now. ----------------------------------------------------------------- The Flesch Readability Index is a simple tool to gauge the legibility of a document without linguistic analysis. The index is calculated as follows: *Count all words in the file. A word is any sequence of characters delimited by white space ( spaces, tabs, or blank lines), whether or not it is an actual English word. *Count all syllables in each word. To make this simple use the following rules (in order of precedence): 1. Each group of adjavend vowels (a, e, i, o, u, y)counts as one syllable. Fore example, the "ea" in "real" counts as one syllable, but the "e" and "a" in "reagal" count as two syllables since they are separated by a consonant. 2. An "e" at the end of a word does not count as a syllable. For example, the "e" in "cake" does not count as a syllable. However, the "eye" in "buckeye" does count as a syllable accourding to rule 1. 3. Each word has at least one syllable, even if the previous rules give a count of 0. For example, the word "the" counts as one syllable, and the word "plbtbrbrtt" also counts as one syllable. *Count all sentences. A sentence is ended by a period, colon, semicolon, question mark, or exclamation mark. *The index is computed as: Index = 206.835 - 84.6 * (number of syllables / number of words) - 1.015 * (number of words / number of sentences) rounded to the nearest interger. This index is an interger, usualy between 0 and 100, indication how difficult the text is to read. Note that lower numbers indicate a more difficult reading level. The table translates the index into various educational levels. Index Educational Level 91-100 5th grader 81-90 6th grader 71-80 7th grader 66-70 8th grader 61-66 9th grader 51-60 High school student 31-50 College student 0-30 College graduate Less than 0 Law school graduate Your program should read a text file in and computer the legibility index. THe end of the text file will be indicated by a single line containing only the letters ZZZ. You may assume that the index computed will be at most 100. Output for the program consists of the nuimber of syllables, number of words, number of sentences, readability index and the corresponding educational level. ----------------------------------------------------------------- So that is what I am trying to do. I don''t want you guys to think that this is some kind of prodject or test for a CS class so I dont realy want you to post the completed prodject (if someone has already done this or wants to try it as a challenge I mean). I would just like mabee some refrences on how you check if they are consonants or not and how to check for white space, and how to check if whether the letter before the current letter was a vowel or not.

Share this post


Link to post
Share on other sites
Basically, most of this can be accomplished by judicious use of the C++ STL. Have a read of the I/O and String sections on this page. It''ll take a lot of the hard work out of accomplishing your goal.

Share this post


Link to post
Share on other sites