Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ** EPITECH PROJECT, 2018
- ** secondEx
- ** File description:
- ** secondEx
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "castmania.h"
- int integer_div(int a, int b)
- {
- return (b ? a / b : 0);
- }
- float decimale_div(int a, int b)
- {
- return (b ? (float)a / (float)b : 0);
- }
- void exec_div(division_t *operation)
- {
- if (!operation->div_type) {
- ((integer_op_t *)operation->div_op)->res = integer_div((\
- (integer_op_t *)operation->div_op)->a, \
- ((integer_op_t *)operation->div_op)->b);
- } else {
- ((decimale_op_t *)operation->div_op)->res = decimale_div((\
- (decimale_op_t *)operation->div_op)->a, \
- ((decimale_op_t *)operation->div_op)->b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement