コード例 #1
0
ファイル: check_format.c プロジェクト: John-Goss/Printf
int		check_format(const char *format)
{
    t_struct	form;
    int			i;

    i = 0;
    init_struct(&form);
    while ((check_options(format[i], &form)) == 1)
        i++;
    while ((check_minimal_large(format[i], &form)) == 1)
        i++;
    if (format[i] == '.')
    {
        form.prec = 0;
        while ((check_precision(format[++i], &form)) == 1)
            continue;
    }
    while (format[i] == 'h' || format[i] == 'l' || format[i] == 'j'
            || format[i] == 'z')
    {
        check_size_modifier(format + i, &form);
        i++;
        if ((&form)->hh > 0 || (&form)->ll > 0)
            i++;
    }
    check_type(format[i]) == 1 ? (&form)->type = format[i] : 0;
    return (check_block(ft_strsub(format, 0, i + 1), &form));
}
コード例 #2
0
void print_array(double** integral_array,double precision){
  printf("%-10s%-12s%-22s%-22s%-22s%-22s%-22s\n","Intervals","Precision","k=1","k=2","k=3","k=4","k=5");
  for (int i = 0; i < 16; ++i)
  {
    if(integral_array[i][0] == 0 ){printf("\n"); break;}
    printf("n = %-2.0f %-1s",pow(2,i),"");
    check_precision(integral_array,i,precision, true);
    for (int j = 0; j <16; ++j)
    { 
      if(integral_array[i][j] == 0 ){break;}
      printf("%-1s %.11f ","",integral_array[i][j]);

    }
    printf("\n");
    //check_precision(integral_array,i,(1/pow(10,12)),true);
  }
}