天天看點

二級題庫(6)答案

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);
}


#include <stdio.h>
/**********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++;
  }
}


float fun (float h )
{
    int tmp=(int)(h*1000+5)/10;
    return (float)tmp/100.0;
}