Code:// From Daniwebs/cprograming #include <iostream> #include <fstream> using namespace std; int main() { int i, len, freq[15]={0}, wcnt, scnt; char word[15], lastchr; ifstream infile("document.txt"); wcnt=0; scnt=0; while (infile>> (1)______ ) { // To read a word wcnt++; len = (2)_____(word); // find the length of word lastchr = word[len(3)___1]; // get the last character if (lastchr=='.'||lastchr==','||lastchr=='?') (4)____--; if (lastchr=='.'||lastchr=='?') (5)_____++; freq[(6)____]++; } cout << "Number of words: " << (7)_____ << endl; cout << "Number of sentences: " << (8)______ << endl; cout << endl; cout << "Len\tFreq" << endl; cout << "---\t----" << endl; for (i=1; i<15; i++) cout << (9)____ << '\t' << freq[ (10)___ ] << endl; system("pause"); return 0; }
Here is a code I found on the web, but I do not know how to solve it. Have problems solving it. solve most of the it but left 10 blanks which I do not know how to feel it up.
Please help and thanks!