We want to create a vector of strings, where each element represents a single ingredient so that if we need multiple of that ingredient,...
X767: Individual ingredient vector in C++
We want to create a vector of strings, where each element represents
a single ingredient so that if we need multiple of that ingredient,
it should be in the list repeatedly. Given a whole number, amount
, and
the name of the ingredient, name
, Add as many of the name
in the list
vector as the amount
specifies. When amount is not a positive number, it
should return an empty vector. Example: ingredients(2,"apple")
should
return a vector containing: {"apple","apple"}
Your Answer:
Feedback
Your feedback will appear here when you check your answer.