想问一下用c++语言输入一串数字后,如何使结果以每个数字以空格隔开输出?
例如:输入12345
输出结果为:1 2 3 4 5
楼上说的对
#Include <iostream>
using namespace std;
int main()
{
char s[1000];
gets(s);
int i=0;
while(s[i] !='\0')
{
cout<<s[i]<<" ";
i++;
}
return 0;
}