Added math module

This commit is contained in:
netbenix 2020-11-19 12:31:31 +01:00
parent f177b3a3dd
commit fc462e3f81
4 changed files with 37 additions and 1 deletions

24
etc/math.c Normal file
View file

@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "../utils/logger.h"
#include "math.h"
double Add(double x, double y){
return(x + y);
}
double Sub(double x, double y){
return(x - y);
}
double Mul(double x, double y){
return(x * y);
}
double Div(double x, double y){
if (y == 0.0)
return 0.0;
else
return(x / y);
}

9
etc/math.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef _MATH_H_
#define _MATH_H_
double Add(double x, double y);
double Sub(double x, double y);
double Mul(double x, double y);
double Div(double x, double y);
#endif

1
main.c
View file

@ -15,6 +15,7 @@
#include "utils/sql_test.h"
#include "etc/logo.h"
#include "etc/man.h"
#include "etc/math.h"
#include "etc/your-reality.h"
#include "utils/logger.h"
#include "utils/sys_info.h"

View file

@ -2,7 +2,7 @@ CC= gcc
ARGS= -export-dynamic -ansi -std=gnu99
CFLAGS= $(shell pkg-config --cflags gtk+-3.0) -I/usr/include/mysql
LDLIBS= $(shell pkg-config --libs gtk+-3.0) -L/usr/lib/mysql -lmysqlclient
OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o
OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o math.o
netbenixCMD: $(OBJ)
$(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS)
@ -28,5 +28,7 @@ update_check.o: utils/update_check.c
$(CC) $(CFLAGS) -c utils/update_check.c
man.o: etc/man.c
$(CC) $(CFLAGS) -c etc/man.c
math.o: etc/math.c
$(CC) $(CFLAGS) -c etc/math.c
your-reality.o: etc/your-reality.c
$(CC) $(CFLAGS) -c etc/your-reality.c