#include <iostream>
using namespace std;
#define SIZE 100
int main() {
int a[SIZE] = {0};
char t = '\0';
int i = 0;
do {
cin>>t;
if(t>='0' && t<='9') {
int c = t-'0';
a[i] *= 10;
a[i] += c;
} else if(t == ' ') {
i++;
}
} while(t != '\n');
return 0;
}
这样只需要一次回车,各元素用空格间隔。