int main()
{
	print_char(first_digit(2));
	print_char(first_digit(-13));
	print_char(first_digit(INT_MIN));
	print_char(first_digit(1234));
	print_char(first_digit(4321));
	return (0);
}
int main(void){
  int number;
  int length;
  int first;
  int power;
  int body;
  int i;
  int length_copy;
  char num;
  number = 98;
  length_copy = number_length(number);
  /*do this for the lenght of the number*/
  for(i = 0 ; i < length_copy; i++)
  {
    length =  number_length(number);
    first = first_digit(number, length);
    /*converting an integer to a char*/
    num = first +48;
    write(1, &num, 1);
    power = power_of(length);
    body = num_body(number, power, first);
    number = body;
  }
  return 0;
}
Example #3
0
static GBitmap* set_weather_icon (int conditions) {
    static GBitmap *icon_bitmap;
    if ( first_digit(conditions) == 2) {
        //thunder
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_THUNDER_BLACK);
    } else if ( first_digit(conditions) == 3 || first_digit(conditions) == 5 ) {
        //rain
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_RAIN_BLACK);
    } else if ( first_digit(conditions) == 6 ) {
        //snow
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_SNOW_BLACK);
    } else if ( first_digit(conditions) == 7 ) {
        //mist
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_FOG_BLACK);
    } else if ( first_digit(conditions) == 9 ) {
        //extreme
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_WIND_BLACK);
    } else if ( conditions == 800 ) {
        //sunny
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_CD40T_BLACK);
    } else if ( first_digit(conditions) == 8 ) {
        //cloudy
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_CLOUDY_BLACK);
    } else {
        // general weather symbol
        icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_NA_BLACK);
    }
    return icon_bitmap;
}
int main(void)
{
  print_char('0' + first_digit(1024));
  print_char('0' + first_digit(-3));
  print_char('0' + first_digit(3024));
  print_char('0' + first_digit(-7000000));
  print_char('0' + first_digit(0));
  print_char('0' + first_digit(INT_MAX));
  print_char('0' + first_digit(INT_MIN));
  return (0);
}
Example #5
0
void Telnum::set_telnum(string stelnr) {
    if (stelnr.size() == 0) {
        throw std::runtime_error("Keine Telefonnummer!\n");
    }
    if (first_digit(stelnr[0]) == false) {
        throw std::runtime_error("Ungueltige Telefonnummer!\n");
    }
    for (int i = 1; i < stelnr.size(); i++) {
        if (proof_digit(stelnr[i]) == false) {
            throw std::runtime_error("Ungueltige Telefonnummer!\n");
        }
    }
    telnr = stelnr;
}
int main(void) {
  print_number(first_digit(92347));
  return (0);
}