Write me a c++ script implementing the Tortellini's recipe
- User
Write me a c++ script implementing the Tortellini's recipe
- Assistant
Sure, I'd be happy to help you with that! Here's a C++ script that implements a recipe for Tortellini with a simple tomato sauce. This recipe assumes you have already prepared the tortellini pasta and are ready to cook it. Here's the code:
cpp#include <iostream> #include <string> #include <vector> // Function to display a step in the recipe void displayStep(const std::string& step) { std::cout << "Step: " << step << std::endl; } // Function to display a list of ingredients void displayIngredients(const std::vector<std::string>& ingredients) { std::cout << "Ingredients:" << std::endl; for (const auto& ingredient : ingredients) { std::cout << "- " << ingredient << std::endl; } } // Function to cook the tortellini and tomato sauce void cookTortellini() { // Ingredients std::vector<std::string> ingredients = { "1 pound fresh tortellini pasta", "2 tablespoons olive oil", "1 small onion, finely chopped", "2 cloves garlic, minced", "1 can (14.5 ounces) diced tomatoes", "1 can (8 ounces) tomato sauce", "1 teaspoon dried basil", "1 teaspoon dried oregano", "Salt and pepper, to taste", "Grated Parmesan cheese, for serving" }; displayIngredients(ingredients); // Steps displayStep("1. Bring a large pot of salted water to a boil. Add the tortellini and cook according to package instructions."); displayStep("2. While the tortellini is cooking, heat the olive oil in a large skillet over medium heat."); displayStep("3. Add the onion and cook until softened, about 5 minutes."); displayStep("4. Add the garlic and cook for an additional 1-2 minutes, until fragrant."); displayStep("5. Add the diced tomatoes, tomato sauce, basil, oregano, salt, and pepper to the skillet. Stir to combine."); displayStep("6. Bring the sauce to a simmer and cook for 10-15 minutes, until slightly thickened."); displayStep("7. Drain the cooked tortellini and add it to the skillet with the sauce. Stir to combine."); displayStep("8. Serve the tortellini hot, topped with grated Parmesan cheese."); } int main() { cookTortellini(); return 0; } - User
Please rewrite it using a struct for storing quantities for a single person
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.