int num;
while (cin >> num) {
    ...
}
敲回车键后,Cltr+D