Advertisement
Saint603

Untitled

Mar 4th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. ifstream inputFile;
  7. string filename, text, singleLine;
  8.  
  9. int main() {
  10. cout << "Please enter a file name\n";
  11. cin >> filename;
  12. inputFile.open(filename);
  13.  
  14. if (inputFile.fail()) {cout << "FILE OPEN ERROR"; return 0;}
  15. else;
  16.  
  17. while (!inputFile.eof()){
  18.  
  19.  
  20. for (int line = 0; line < 24; line++) {
  21. getline(inputFile, singleLine);
  22. text = text + singleLine + "\n";}
  23. cout << text;
  24. system("pause");}
  25.  
  26. inputFile.close();
  27. return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement