Question
Using C++ (not C) , how to use ifstream getline fin to read the below the .txt file, store in given variables, and print it
Using C++ (not C), how to use ifstream getline fin to read the below the .txt file, store in given variables, and print it out
string title;
string level;
string ingredient;
Notice: There is a blank line between the ingredient part and direction part. I just want to read the input and it must stop reading when it hit the direction part, skip the direction part and the move to another recipe and keeps reading. There are different ingredients for each recipe
Example file:
Chocolate Drop Cookies with Caramelized White Chocolate Filling
Author: Recipe courtesy of Alex Guarnaschelli
Total: 1 hr 25 min
Level: Easy
Ingredients
Cookies:
3/4 cup chopped semisweet chocolate
1/3 cup chopped unsweetened chocolate
3 tablespoons lightly salted butter
1 egg, room temperature
1/3 cup granulated sugar
1 teaspoon vanilla extract
1/4 cup all-purpose flour
1/8 teaspoon baking powder
1/4 teaspoon kosher salt
White Chocolate Filling:
2 cups white chocolate, chopped
1/4 cup mascarpone, room temperature
1 tablespoon dark rum
Directions
For the cookies:
Preheat an oven to 350 degrees F.
In a metal bowl, combine both chocolates with the butter. Put the bowl over a pot of boiling water for a makeshift double boiler. Lower the heat so the water is hot but not boiling. Stir the chocolate with a plastic spatula, from time to time, until the chocolate and butter melt together. Set aside.
In a large bowl, whisk together the egg, sugar and vanilla. Beat until the mixture comes together and becomes a pale yellow color, about 1 minute.
Combine the flour, baking powder and salt in a separate bowl. Sift and add it to the egg mixture. Stir until blended. Using a rubber spatula, add half of the melted chocolate to the batter and gently stir to combine. Add the remaining chocolate and stir again until combined.
Drop tablespoonfuls of the cookie batter onto a greased baking sheet or a greased parchment-lined baking sheet. Leave room in between the cookies so they can spread out as they bake. You should be able to drop 18 cookies total, on the baking sheet, depending on their size.
Put the baking sheet in the center of the oven and bake for 4 minutes. Rotate the pan halfway and bake for an additional 4 minutes. Remove the pan from the oven and allow the cookies to cool, 10 to 15 minutes, before transferring to a plate.
For the filling:
Preheat the oven to 250 degrees F. Put the chopped white chocolate into a baking dish, preferably not a metal dish, and melt it in oven. Remove it after about 10 minutes and stir. Put back into the oven and continue to cook until caramelized, about 10 minutes.
Meanwhile, whisk together the mascarpone and rum in a small bowl.
Add the caramelized chocolate to a medium bowl. Blend in the mascarpone mixture until combined. Refrigerate until the cookies have cooled.
Bring the filling to room temperature before spreading it between the cookies to make sandwiches.
Chocolate Fudge
Author: Alton Brown
Level: Intermediate
Ingredients
fudge:
2 3/4 cups sugar
4 ounces unsweetened chocolate
3 tablespoons butter, plus more for greasing pan
1 cup half-and-half
1 tablespoon corn syrup
1 tablespoon vanilla extract
1 cup chopped, roasted nuts, optional
Directions
Grease an 8 by 8-inch pan with butter. In a heavy-bottomed saucepan, combine the sugar, chocolate, 1 1/2 tablespoons of the butter, half-and-half, and corn syrup. Over medium heat, stir with a wooden spoon until sugar is dissolved and chocolate is melted. Increase heat and bring to a boil. Reduce heat to medium-low, cover, and boil for 3 minutes. Remove the cover and attach a candy thermometer to the pot. Cook until the thermometer reads 234 degrees F. Remove from the heat and add the remaining butter. Do not stir. Let the mixture cool for 10 minutes or until it drops to 130 degrees F. Add vanilla and nuts, if desired, and mix until well-blended and the shiny texture becomes matte. Pour into the prepared pan. Let sit in cool dry area until firm. Cut into 1-inch pieces and store in an airtight container for up to a week.
Apple Crumble with Cardamom-Vanilla Caramel Sauce
Author: Melissa dArabian
Level: Intermediate
Ingredients
For the Apple Filling:
3 Granny Smith apples, peeled, cored, and sliced
Zest and juice of 1 lemon
2 tablespoons granulated sugar
1 teaspoon ground cinnamon
Pinch salt
For the Crumble Topping:
2/3 cup all-purpose flour
2/3 cup brown sugar
2/3 cup oats
Pinch salt
1 stick (4-ounces) unsalted butter
For the Vanilla-Cardamom Caramel Sauce:
2/3 cup sugar
1/4 cup water
1 tablespoon butter
1/2 cup heavy cream or half-and-half
1 teaspoon vanilla extract
1 teaspoon cardamom seeds, gently crushed to release oils
Directions
Preheat the oven to 350 degrees F.
To make the Apple Filling:
In a small bowl, toss the apple slices with the lemon zest, lemon juice, sugar, cinnamon, and salt, and set aside.
To make the Crumble Topping:
In another small bowl, mix the flour, brown sugar, oats, and salt with a fork until uniform. In a baking dish, melt the butter in the microwave until about half melts, 10 to 15 seconds on high. Pour the butter into the flour mixture and incorporate with a fork. Leaving the excess butter in the baking dish, arrange the apple slices in the dish. Top with the flour-oat mixture. Bake until the apples are cooked through and the topping is golden, about 45 minutes.
To make the Vanilla-Cardamom Caramel Sauce:
In a medium-heavy saucepan, mix the water and sugar and bring to a boil over medium-high heat. Allow the mixture to boil, without stirring. Cook's Note: Swirl the pan, if needed. Boil until the sugar mixture is pale golden brown, approximately 7 minutes.
Remove the pan from the heat, and stirring vigorously add the butter and cream. The mixture will bubble. Add the cardamom seeds and stir to incorporate. Return the pan to the heat and bring the mixture to a boil and then remove from the heat and allow to cool a few minutes. Stir in the vanilla extract and strain the sauce before drizzling over the cobbler.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started