c语言
while (scanf("%d", &a) != EOF)
{
printf("%d\n", a);
}
c++
过程中使用cin.get()=='\n'判断输入回车终止输入
#include <iostream>
using namespace std;
int main() {
char a[10] = { '\0' };
int i = 0;
while (cin >> a[i]) {
i++;
if (cin.get() == '\n') {
break;
}
}
for (int j = 0; j < i; j++) {
cout << a[j] << i;
}
return 0;
}