Wrote the code:
#include <fstream> #include <iostream> using namespace std; int main() { ifstream input ("c:\\f.txt"); string s; getline(input, s); cout << s << endl; system("PAUSE"); return EXIT_SUCCESS; } But it displays only the first element from the file. And how to make it so that each time you press the "A" key, +1 element is displayed on the screen?
getlinereturns a link toistream, which is converted to abool, which is converted to anintand0is displayed. - andrybak