统计个数的;
#include
#include
main()
{
int i,k=0;
char s[40];
gets(s);
for(i=0;i if(s[i]>='0'&&s[i]<='9') if(i==0||(s[i-1]<'0'||s[i-1]>'9')&&s[i-1]!='-')k++; printf("%d\n",k); } 输出数字的: #include #include main() { int i,k=0; char s[40]; gets(s); for(i=0;i if(s[i]>='0'&&s[i]<='9') if(i==0||(s[i-1]<'0'||s[i-1]>'9')&&s[i-1]!='-') { while(s[i]>='0'&&s[i]<='9'&&i printf("%c",s[i++]); printf("\n"); } }