I have a question its more of a curiosity thing really. When I compile the code below and make an exe the program works differently depending on the compiler I use. Yet the code is exactly the same. Anyone know why?
When I compile that with VC++, it prompts me to enter a value. After I type whatever in and press enter, I have to press Enter once again for the cout statement to work.Code:#include <iostream> #include <string> using namespace std; int main() { string y; getline(cin,y); cout << y; return 0; }
But when compiled in Dev C++ , it works properly and the cout statement executes as soon as I hit enter. Any idea why they work differently if its the same exact code?