How works while ( getline (MyFile, line) ) { cout << line << '\n'; } ? | Sololearn: Learn to code for FREE!


How works while ( getline (MyFile, line) ) { cout << line << '\n'; } ?

We take line from file MyFile, enter it to line, and then move the cursor to next line. In while in this iteration is address (what is the address?). We output line, and all starts again, and so while in while getline doesn't give 0. And getline give 0, when in line MyLine, where is the cursor, will not give empty. Is everything correct?

8/13/2017 2:20:00 PM


1 Answer

New Answer


Have you declare a variable? (I’m new like all I know is how to print words and address a variables so take this with a grain of salt plz) hopefully someone who knows more can help. Well any way we established the variable issue Like “int MyFile = line; ” this may not work on the off chance it does then cool but I don’t expect it to. Or try To declare line as int and make Line capital. Int Line = MyFile;