Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream fin("aaaaa.txt");
- int word=1;
- char ch;
- fin.seekg(0,ios::beg);
- while(fin)
- {
- fin.get(ch);
- if(ch==' '||ch=='\n')
- word++;
- }
- cout<<"\nWords="<<word<<"\n";
- fin.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment