#include<iostream>

#include<fstream>

using namespace std;


int main(){

ifstream input;

char word[50] = {0,};


input.open("text.txt");



if (input.fail())

return 1;

while (input.eof() == false)

{

input >> word;

cout << word << endl;

}


input.close();

return 0;

}




text.txt 안에있는 내용들을 한줄씩 cmd 화면에 출력시켜주는 프로그램인데


어떻게 그렇게 될수있는거야?


word 안에는 아무것도없는데 ..?


input >> word; 이부분이  한줄씩 넣는거라는것까지는 이해가 되는데


어떻게 차례대로 한줄씩 넣지?

for 문처럼 i++ 해서 점점 다음줄로 넘어가는형식이라면 이해가 되는데


그런 증감식도없는데 알아서 척척 넣는게 어떤원리야?