Felanpro

ifstream, reading from files

May 11th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. ifstream file1("players.txt"); //ofstream is for writing into a file and ifstream is for reading from a file.
  2.  
  3.     int id;
  4.     string name;
  5.     double money;
  6.  
  7.     while(file1 >> id >> name >> money) //Coming from file
  8.     {
  9.         cout << id << ", " << name << ", " << money << endl;
  10.     }
Add Comment
Please, Sign In to add comment