Why does my program require a final hit of return key to exit?
OS: Windows 2000. Compiler: Visual C++ 6.0.
Basically, I have a simple program in one function to output a typed in line to a file. I call the output function from the Main function. However, the result is in the attached screenshot. In order to end the program, I would hit enter from the current (screenshot) point, and the window would close.
1. Why is there a new line after the first line is printed?
2. Why is "Line to log: " displayed again after I type exit?
Here is the code:
while (1 == 1)
cout <<"Line to log: ";
getline (cin, currentline); //stores the whole input line into currentline, with a return as end of line
if (currentline != "exit" && currentline != "")
else if (currentline == "exit")