I have g++ installed on Windows 10 with MinGW-w64, and when I run a program with an infinite loop and then I stop it with Ctrl+C, it only outputs the first std::cout after the loop. Here is an example:
#include <iostream>
using namespace std;
int main () {
int n;
while (cin>>n);
cout<<n*2<<"."<<n*3<<"."<<n*4<<endl;
}
If I input 25
in the console and stop it with Ctrl+C, it outputs 50
. But if I build the same program on my Ubuntu machine, input also 25
and exit the loop with Ctrl+D it outputs 50.75.100
. Why is the behaviour different?