From 8b6e91bdb56bc01a588718472546f2a88e750b48 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 19 Jul 2019 07:04:04 +0200 Subject: c10 done?, c11 moulinetted (ex04, ex06 need correction) --- c11/ex05/parse.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'c11/ex05/parse.c') diff --git a/c11/ex05/parse.c b/c11/ex05/parse.c index 5b1c531..1540945 100644 --- a/c11/ex05/parse.c +++ b/c11/ex05/parse.c @@ -6,10 +6,12 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/07/17 08:05:59 by cacharle #+# #+# */ -/* Updated: 2019/07/17 08:35:50 by cacharle ### ########.fr */ +/* Updated: 2019/07/18 10:40:34 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ +#include + int parse(int argc, char **argv) { int i; @@ -27,13 +29,21 @@ int parse(int argc, char **argv) else if (argv[2][0] == '%') i = 4; else - i = -2; + i = -2; return (i); } -/*int make_operation(int x, int y, int (*operator)(int, int))*/ -/*{*/ - - /*retu*/ - -/*}*/ +int check_floating_point_error(int operator_index, int y) +{ + if (operator_index == 3 && y == 0) + { + write(1, "Stop : division by zero\n", 24); + return (-1); + } + if (operator_index == 4 && y == 0) + { + write(1, "Stop : modulo by zero\n", 22); + return (-1); + } + return (0); +} -- cgit