#include "stdio.h"#include "conio.h"#include "string.h"int StrToInt(char *s){//************************************************//=================================================}int main(){ char t[32];// freopen("Str2Int.in", "r", stdin);// freopen("Str2Int.out", "w", stdout);gets(t);printf("%d", StrToInt(t));return 0;}
1 回答

慕容708150
TA貢獻1831條經(jīng)驗 獲得超4個贊
int delnum(char s[], int *p)
{
int i,n,j;
*p = NULL;
n=strlen(s);
for(i=0,j=0;i<n;i++)
if(!(s[i]>='0'&&s[i]<='9'))
s[j++]=s[i];
else
*p += s[i]-'0';
s[j]='\0';
return n-strlen(s);
}
void main()
{
char item[80] = "my2009xy3com+";
int n,count;
count=delnum(item,&n);
printf("%s,count=%d,sum=%d",item,count,n);
system("pause");
}
- 1 回答
- 0 關(guān)注
- 96 瀏覽
添加回答
舉報
0/150
提交
取消