Skip to content

Commit

Permalink
ok pow
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasvienot committed Mar 16, 2019
1 parent cdb673e commit d90b1b8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
6 changes: 3 additions & 3 deletions libft/ft_itoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/15 22:18:46 by nvienot #+# #+# */
/* Updated: 2018/11/22 17:52:20 by nvienot ### ########.fr */
/* Updated: 2019/03/16 02:19:45 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -37,12 +37,12 @@ char *ft_itoa(int n)
char *repitoa;

len = ft_int_len(n);
if (!(repitoa = (char *)malloc(sizeof(char) * (len + 1))))
return (NULL);
if (n == -2147483648)
return (ft_strdup("-2147483648"));
if (n == 0)
return (ft_strdup("0"));
if (!(repitoa = (char *)malloc(sizeof(char) * (len + 1))))
return (NULL);
if (n < 0)
{
repitoa[0] = '-';
Expand Down
2 changes: 1 addition & 1 deletion libft/ft_strjoin.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/15 22:16:18 by nvienot #+# #+# */
/* Updated: 2019/03/16 01:39:30 by nvienot ### ########.fr */
/* Updated: 2019/03/16 02:07:23 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion libft/ft_strjoinnfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/15 22:16:18 by nvienot #+# #+# */
/* Updated: 2019/03/16 01:45:53 by nvienot ### ########.fr */
/* Updated: 2019/03/16 02:14:55 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
29 changes: 13 additions & 16 deletions srcs/ft_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,27 @@
/* By: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/01/22 21:29:22 by nvienot #+# #+# */
/* Updated: 2019/03/16 01:52:14 by nvienot ### ########.fr */
/* Updated: 2019/03/16 02:50:50 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */

#include "fractol.h"

void ft_get(t_win *win)
static void ft_get_pow(t_win *win)
{
printf("%f\n", win->p.pow);
char *x;
char *y;
char *z;
float ent;
int dec;

float salut;
int salut2;

salut = (float)win->p.pow;
salut2 = (int)(10 * salut);
salut2 = salut2 % 10;

x = ft_itoa(salut);
x = ft_strjoinnfree(x, ".", 1);
x = ft_strjoinnfree(x, ft_itoa(salut2), 3);

ent = (float)win->p.pow;
dec = ((int)(10 * ent) % 10);
y = ft_itoa(ent);
x = ft_strjoinnfree(y, ".", 1);
z = ft_itoa(dec);
x = ft_strjoinnfree(x, z, 3);
mlx_string_put(win->mlx_ptr, win->win_ptr, 170, 45, GREY, x);

free(x);
}

Expand Down Expand Up @@ -63,7 +60,7 @@ static void ft_print_menu_1(t_win *win)
mlx_string_put(win->mlx_ptr, win->win_ptr, 120, 5, GREY, F12);
mlx_string_put(win->mlx_ptr, win->win_ptr, 140, 25, \
GREY, x = ft_itoa(win->p.it_max));
// ft_get(win);
ft_get_pow(win);
free(x);
}

Expand Down

0 comments on commit d90b1b8

Please sign in to comment.