Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string contain_of_file,bufor,word,empty=" ",new_line="n";
  10. string conection;
  11. string::size_type position;
  12. cout<<"Give a word";
  13. cin>>word;
  14. ifstream NewFile;
  15. ofstream Nowy1;
  16. Nowy1.open("tekstpa.txt", ios::app);
  17. NewFile.open("plik1.txt");
  18. while(NewFile.good())
  19. {
  20. getline(NewFile, contain_of_file);
  21. cout<<contain_of_file;
  22.  
  23. position=contain_of_file.find("Zuzia");
  24. if(position!=string::npos)
  25. {
  26. conection=contain_of_file+empty+word+new_line;
  27. Nowy1<<conection;
  28. }
  29. Nowy1<<contain_of_file;
  30.  
  31. }
  32. Nowy1.close();
  33. NewFile.close();
  34.  
  35. cin.get();
  36. return 0;
  37. }
  38.  
  39. while (std::getline(NewFile, contain_of_file)) { ... }
  40.  
  41. Nowy1 << contain_of_file << ' ' << word << 'n';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement