ex00: add: main

This commit is contained in:
Camille Chauvet 2023-10-03 15:27:34 +00:00
parent 76f13820ad
commit 049aeafde0
3 changed files with 19 additions and 14 deletions

View File

@ -184,7 +184,7 @@ static int get_input(const std::string& file_path, const std::map<unsigned int,
return 0; return 0;
} }
unsigned int get_price(const std::string& file_path) void get_price(const std::string& file_path)
{ {
static bool db_init = 0; static bool db_init = 0;
static std::map<unsigned int, float> database; static std::map<unsigned int, float> database;
@ -193,17 +193,4 @@ unsigned int get_price(const std::string& file_path)
get_data(database); get_data(database);
get_input(file_path, database); get_input(file_path, database);
return 0;
}
int main(int ac, char** av)
{
if (ac != 2)
{
std::cout << "error: missing file" << std::endl;
return 1;
}
get_price(std::string(av[1]));
return 0;
} }

View File

@ -4,3 +4,7 @@
#define DATA_PATERN "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2},[+\\-]*[0-9]*(\\.[0-9]+)?$" #define DATA_PATERN "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2},[+\\-]*[0-9]*(\\.[0-9]+)?$"
#define INPUT 0 #define INPUT 0
#define DATABASE 1 #define DATABASE 1
#include <string>
void get_price(const std::string& file_path);

14
ex00/src/main.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <iostream>
#include "BitcoinExchange.hpp"
int main(int ac, char** av)
{
if (ac != 2)
{
std::cout << "error: missing file" << std::endl;
return 1;
}
get_price(std::string(av[1]));
return 0;
}