In the task: lasagna-master
It’s my cpp file
#include
#include
#include
#include “lasagna_master.h”
namespace lasagna_master {
int preparationTime(std::vector<std::string> layers, int preparation_time) {
return layers.size() * preparation_time;
}
amount quantities(std::vector<std::string> layers) {
constexpr int noodles_amount_per_layer = 50;
constexpr double sauce_amount_per_layer = 0.2;
const int noodles_amount = noodles_amount_per_layer * std::count(layers.begin(), layers.end(), "noodles");
const double sauce_amount = sauce_amount_per_layer * std::count(layers.begin(), layers.end(), "sauce");
lasagna_master::amount needed_for_lasagna{ noodles_amount, sauce_amount };
return needed_for_lasagna;
}
void addSecretIngredient(std::vector<std::string> my_list, const std::vector<std::string> friends_list) {
my_list.at(my_list.size() - 1) = friends_list.at(friends_list.size() - 1);
}
std::vector<double> scaleRecipe(const std::vector<double> quantities, int amount_of_portions) { //
int scale_ratio = amount_of_portions / 2;
std::vector<double> new_quantities{};
int index = 0;
for (double item : quantities) {
new_quantities.at(index++) = item * scale_ratio;
}
return new_quantities;
}
void addSecretIngredient(std::vector<std::string> my_list, const std::string secret_ingredient) {
my_list.at(my_list.size() - 1) = secret_ingredient;
}
} // namespace lasagna_master
And it’s my .h file
#pragma once
#include
#include
namespace lasagna_master {
struct amount {
int noodles;
double sauce;
};
int preparationTime(std::vector<std::string> layers, int preparation_time = 3);
amount quantities(std::vector<std::string> layers);
void addSecretIngredient(std::vector<std::string> my_list, const std::vector<std::string> friends_list);
std::vector<double> scaleRecipe(const std::vector<double> quantities, int amount_of_portions);
void addSecretIngredient(std::vector<std::string> my_list, const std::string secret_ingredient);
} // namespace lasagna_master
I’ve catched such exception
Could you help me to resolve this situation