Advertisement
adcorp

file handling(6)

Jul 24th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. //count no of words
  2.  
  3. #include<conio.h>
  4. #include<fstream.h>
  5. #include<ctype.h>
  6. void main()
  7. {
  8. clrscr();
  9. int p=0;
  10. ofstream ofile;
  11. ofile.open("adil.txt");
  12.  ofile<<"hello people adil here";
  13.  ofile.close();
  14. ifstream ifile;
  15. ifile.open("adil.txt");
  16. char ch[40];
  17. while(!ifile.eof())
  18.  { ifile>>ch;
  19.  
  20.    p++;
  21.  };
  22. cout<<p;
  23. getch();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement