>> Dont really need the <<endl; thing
It will flush the buffer, which should be done before the cin.get() call, but you never know.
cin is linked with cout (I forget the exact term), so that whenever you call cin, cout is flushed.
Why do you think this works?
Code:
#include <iostream>
int main(void) {
std::cout << "Enter a number: ";
int n;
std::cin >> n;
return 0;
}
You would think cout wouldn't be flushed, and it wouldn't print the prompt. But it does.
If you want to flush a stream without printing a '\n', use flush:
Code:
cout << "Reading from file" << flush;