Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- ifstream inputFile;
- string filename, text, singleLine;
- int main() {
- cout << "Please enter a file name\n";
- cin >> filename;
- inputFile.open(filename);
- if (inputFile.fail()) {cout << "FILE OPEN ERROR"; return 0;}
- else;
- while (!inputFile.eof()){
- for (int line = 0; line < 24; line++) {
- getline(inputFile, singleLine);
- text = text + singleLine + "\n";}
- cout << text;
- system("pause");}
- inputFile.close();
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement