-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathf_print.c
69 lines (63 loc) · 1.62 KB
/
f_print.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* f_print.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jinpark <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/11 19:36:45 by jinpark #+# #+# */
/* Updated: 2019/04/26 15:15:05 by jinpark ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void f_print_func(char *s, t_store *a)
{
int i;
int len;
int mid;
i = -1;
len = ft_strlen(s);
if (a->wid > len)
{
mid = a->wid - len;
while (++i < mid)
ft_putchar(' ');
}
i = -1;
while (s[++i] != '\0')
ft_putchar(s[i]);
if (a->prec > 6)
{
mid = a->prec;
while (++i < mid)
ft_putchar('0');
}
}
void f_minus_print_func(char *s, t_store *a)
{
int i;
int len;
int mid;
i = -1;
len = ft_strlen(s);
while (s[++i] != '\0')
ft_putchar(s[i]);
if (a->prec > 6)
{
mid = a->prec - i;
while (i++ < mid)
ft_putchar('0');
}
i = -1;
if (a->wid > len)
{
mid = a->wid - len;
while (++i < mid)
ft_putchar(' ');
}
}
long double big_round_up_check(long double f)
{
f = f + 0.00000045;
return (f);
}