Files
cpp09/ex00/main.cpp
2026-04-24 12:36:15 +02:00

49 lines
1.4 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/23 19:58:34 by aortigos #+# #+# */
/* Updated: 2026/04/24 12:15:14 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "BitcoinExchange/BitcoinExchange.hpp"
using std::cout;
using std::endl;
int main(int argc, char **argv)
{
if (argc != 2)
{
cout << "Error: could not open file." << endl;
return (1);
}
std::ifstream database("data.csv");
std::ifstream inputFile(argv[1]);
if (!database || !inputFile)
{
cout << "Error: could not open file." << endl;
return (1);
}
BitcoinExchange bc;
try {
bc.readDatabase(database);
bc.execute(inputFile);
} catch (std::exception &e)
{
std::cout << e.what() << std::endl;
}
return (0);
}