-
C++ Code
Quote:
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! :D
-
-
-
Moved to the C++ Programming forum.
You "solve most of the it but left 10 blanks"? You can stop bluffing now and do your own homework.
-
^_^v
Sweet! I love "Madlibs".
Code:
1): template
2): namespace
3): double
4): iostream
5): vector
6): std::copy
7): typename
8): bad_alloc
9): iterator
10): while
Soma
-
Kids, remember these two things: do your own homework -- don't cheat -- and don't feel up code unless the code gives you permission; that's just wrong.
-
Quote:
Originally Posted by
phantomotap
^_^v
Sweet! I love "Madlibs".
Code:
1): template
2): namespace
3): double
4): iostream
5): vector
6): std::copy
7): typename
8): bad_alloc
9): iterator
10): while
Soma
You C++ noob, even a beginner knows what you wrote is complete bull, the answer should be obvious to anyone with at least half a brain cell:
1): I
2): am
3): too
4): lazy
5): to
6): do
7): my
8): own
9): homework
10): !
-