37 lines
847 B
C
37 lines
847 B
C
#ifndef LOGIC_H
|
|
#define LOGIC_H
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <ncurses.h>
|
|
#include <json-c/json.h>
|
|
|
|
struct product {
|
|
float cost;
|
|
int numberSold;
|
|
char name;
|
|
};
|
|
|
|
/* File */
|
|
int existsFile(const char *fname);
|
|
int createFile(const char *fname);
|
|
int renameDataFile(const char *oldName, const char *newName);
|
|
|
|
/* Prodotti */
|
|
json_object *getProducts(const char *fname);
|
|
void listProducts(const char *fname);
|
|
int addProduct(const char *fname, const char *name, double price);
|
|
double getPrice(const char *fname, const char *name);
|
|
|
|
/* Copie vendute */
|
|
int getCount(const char *fname, const char *name);
|
|
void listSold(const char *fname);
|
|
int addSold(const char *fname, const char *name, int qty);
|
|
|
|
/* Entrate */
|
|
double getTotalRevenue(const char *productsFile, const char *soldFile);
|
|
|
|
#endif
|