diff --git a/ex00/src/BitcoinExchange.cpp b/ex00/src/BitcoinExchange.cpp index 4d7f92d..c709380 100644 --- a/ex00/src/BitcoinExchange.cpp +++ b/ex00/src/BitcoinExchange.cpp @@ -170,12 +170,12 @@ static int get_input(const std::string& file_path, const std::map::const_iterator it = database.upper_bound(line_parsed.first); - if (it->first < line_parsed.first) + if (it == database.begin()) std::cout << "Error: bad input => " << utodate(line_parsed.first) << std::endl; else std::cout << utodate(line_parsed.first) << " => " << line_parsed.second - << " = " << line_parsed.second * it->second << std::endl; + << " = " << line_parsed.second * (--it)->second << std::endl; } }