Guest User

Untitled

a guest
Dec 9th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. # include <iostream>
  2. # include <fstream>
  3. # include <cstdlib>
  4. using namespace std;
  5. int main()
  6. {
  7.     ifstream fin;
  8.     char words;
  9.     cout << "What is the name of the file? ";
  10.     char file[20];
  11.     cin >> file;
  12.     fin.open(file);
  13.     if (fin.fail())
  14.     {
  15.         cout << "The File" << file << " won't open" << endl;
  16.         exit(1);
  17.     }
  18.     fin.get(words);
  19.     while(!fin.eof())
  20.     {
  21.         cout << words;
  22.         fin.get(words);
  23.        
  24.  
  25.  
  26.     }
  27.     fin.close();
  28.     return 0;
  29. }
Add Comment
Please, Sign In to add comment