第一题:(1)'0'(2)s++(3)ctod(a)+ctod(b)
第二题:(1)void fun ( char *s, int *a, int *b )(2)++(*a);(3)++(*b);
第三题:float fun ( float h )
{
long i=h*1000;
if(i%10<5) return (i/10)/100.0;
else return (i/10+1)/100.0;
}
最讨厌这种题目了,比我自己把整个程序都写出来还麻烦
1、
long ctod( char *s )
{ long d=0;
while(*s)
if(isdigit( *s)) {
/**********found**********/
d=d*10+*s-'0';
/**********found**********/
s++; }
return d;
}
long fun( char *a, char *b )
{
/**********found**********/
return ctod(a)+ctod(b);
}
2、
#include
/**********found**********/
void fun ( char *s, int* a, int* b )
{
while ( *s )
{ if ( *s >= 'A' && *s <= 'Z' )
/**********found**********/
*a=*a+1 ;
if ( *s >= 'a' && *s <= 'z' )
/**********found**********/
*b=*b+1;
s++;
}
}
3、
#include
float fun ( float h )
{
return ((int)(h*100+0.5))/100.0;
}