#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条经验 获得超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 关注
- 62 浏览
添加回答
举报
0/150
提交
取消