// Online C++ compiler to run C++ program online #include <iostream> //#include <cstdio> //#include <vector> //#include <iostream> //#include <algorithm> #include <list> // for arra list list<foodIdeams>.... using namespace std; class foodList{ public: string recipe; list<string> ingredient; foodList(string Recipe){ recipe = Recipe; } void listMaker(){ cout << "Recipe Name: "<< recipe << endl; cout << "" << endl; cout << "Ingredients: " << endl; for (string e : ingredient){ cout << e << endl; } } }; int main() { foodList recipe1("spaghetti"); recipe1.ingredient.push_back("1 pound lean ground meat like beef, turkey, chicken or lamb"); recipe1.ingredient.push_back("3 tablespoons olive oil"); recipe1.ingredient.push_back("1 cup (130 grams) chopped onion"); recipe1.ingredient.push_back("3 garlic cloves, minced (1 tablespoon)"); recipe1.ingredient.push_back("2 tablespoons tomato paste"); recipe1.ingredient.push_back("1/2 teaspoon dried oregano"); recipe1.ingredient.push_back("Pinch crushed red pepper flakes"); recipe1.ingredient.push_back("1 cup water, broth or dry red wine"); recipe1.ingredient.push_back("1 (28-ounce) can crushed tomatoes"); recipe1.ingredient.push_back("Salt and fresh ground black pepper"); recipe1.ingredient.push_back("Handful fresh basil leaves, plus more for serving"); recipe1.ingredient.push_back("12 ounces dried spaghetti or favorite pasta shape"); recipe1.ingredient.push_back("1/2 cup shredded parmesan cheese"); recipe1.listMaker(); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter