第2个回答 2013-08-05
#include<iostream>
#include<string>
#include<process.h>
#include<conio.h>
#include<math.h>#define N 128using namespace std;unsigned long fun(char* str)
{
char* p=str;
unsigned long k=0;
while(*p)
{
if(*p>='0'&&*p<='9')
{
k=k*10+(*p-'0');
}
p++;
}
return k;
}void main()
{
char str[N];
cout<<"Enter String: ";
gets(str);
cout<<fun(str)<<endl;
getch();
}