This program is going to be hawaiian word spell check,
Written Hawaiian also has fairly simple spelling rules for determining if a word is a valid word in the language (even if the meaning is unknown). They are:
* All words contain only vowels and Hawaiian consonants.
* All words end in a vowel.
* Within a word, two consonants NEVER appear adjacent.
Write a program which reads lines of Hawaiian text from a file (using redirection, so you will not need to prompt), and lists each word found on a separate line indicating whether it is a valid Hawaiian spelling or it is invalid. Any non-letter characters (e.g. white space or punctuation characters) in the file should be treated as delimiters, but otherwise ignored and not appear in the output.
ex: it will read something like this:
this is not hawaiian word.
and print:
this it is invalid
is it is invalid
not it is invalid
hawaiian it is valid
word it is invalid
================================================== ===================
I have written a program called is_vowel and is_h_consonant to check if they are.
I also have written a program called delimit_p to see if the input is a delimiter.
This is the program I have so far, it does not work correctly.
Super thanks for whoever that will spend time helping me on this!!!Code:main() { char ch; char last_ch; int inword; int hi; /* we are not in the word at the beginning */ inword = FALSE; /* we assume everything is not hawaiian word */ hi = FALSE; /* set last character as a vowel */ last_ch = 'a'; /* while there are more characters */ while((ch = getchar()) != EOF) { /* if not in word and not a delimiter */ /* then must be the beginnning of a word */ if (!inword && !delimitp(ch)) { inword = TRUE; /* we are in a word now */ } if(inword) { if(is_vowel(ch)) { hi = TRUE; } else if(is_h_consonant(ch)) { if((is_h_consonant(ch) && !is_h_consonant(last_ch)) || (!is_h_consonant(ch) && is_h_consonant(last_ch))) { hi = TRUE; } } else if(delimitp(ch) && is_vowel(last_ch)) { hi = TRUE; } else { hi = FALSE ; } putchar(ch); } last_ch = ch; ch = getchar(); if (inword && delimitp(ch)) /* if in word and a delimiter */ inword = FALSE; /* we are no longer in a word */ if(hi) {printf("\t It is valid!");} /* if it is correct spelling, print it's valid */ else {printf("\t It is invalid!"); } /* if not, print it is invalid */ putchar('\n'); /* print new line character */ hi = FALSE; } }