string f; fstream file; file.open("names.txt"); for (int i = 0; i < 10; i++) { file>>f; cout<<f<<endl; }
Hamza usama ali saleem sharif haseeb saeed sadiq usman bilal
fstream file; file.open("names.txt"); char line[64]; int lineno = 1; do { file.getline(line, 64); if (file.gcount() > 1 && !file.fail()) cout << lineno << ". " << line << endl; lineno++; } while(!file.eof());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)