#include <stdio.h>

int str2int(char *s)
{
  char *p;
  int r = 0;
  for(p = s; *p; ++p)
    if(0x30 <= *p && *p <= 0x39) r = r * 10 + *p - 0x30;
  return r;
}

double str2double(char *s)
{
  char *p;
  double r = 0.0, f = 1.0;
  for(p = s; *p; ++p)
    if(0x30 <= *p && *p <= 0x39){
      r = r * (f >= 1.0 ? 10 : 1) + (*p - 0x30) * (f >= 1.0 ? 1 : f);
      if(f < 1.0) f *= 0.1;
    }else f *= 0.1;
  return r;
}

int main(int ac, char **av)
{
  fprintf(stdout, "%d\n", str2int("9240"));
  fprintf(stdout, "%f\n", str2double("0.0543"));
  fprintf(stdout, "%f\n", str2double("9240.0543"));
  fprintf(stdout, "%d\n", str2int("9240.0"));
  return 0;
}