Initial work on calculator program.

This commit is contained in:
2026-06-28 11:02:36 -04:00
parent c2e6810a9e
commit 912e12399d
7 changed files with 83 additions and 0 deletions

20
calculator/Recipe.cpp Normal file
View File

@@ -0,0 +1,20 @@
#include <exception>
#include <format>
#include <string>
#include "Recipe.h"
std::vector<std::pair<Product, float> > Recipe::Ingredients(float overclock)
{
if(overclock < 0.0f || overclock > 2.5f)
{
auto error = std::format("Invalid overclock of {:.2f}%.", (overclock * 100.0f));
throw std::invalid_argument(error);
}
std::vector<std::pair<Product, float> > rtn;
for(const auto &ingredient : ingredients)
rtn.push_back({ingredient.first, ingredient.second * overclock});
return rtn;
}