Question: can an expert help me with my code but cengage is precise so please follow the comments on the assigment thank you Summary In this


Summary In this lab, you open a file and read input from that file in a prewritten C++ program. The program should read and print the names of flowers and whether they are grow in shade or sun. The data is stored in the input file named flowers.dat. Instructions 1. Ensure the source code file named Flowers.cpp is open in the code editor. 2. Declare the variables you will need. 3. Write the C++ statements that will open the input file flowers.dat for reading. 4. Write a while loop to read the input until EOF is reached. 5. In the body of the loop. print the name of each flower and where it can be grown (sun or shade). 6. Execute the program by clicking the Run button at the bottom of the screen. 1 I/ Flowers.cpp - This program reads names of flowers and whether th 2 If file and prints the information to the user's screen. 11 Input: flowers.dat. I/ Output: Names of flowers and the words sun or shade. 9 using namespace std; int main() 11\{ If Declare variables here // Open input file If Write while loop that reads records from file. f in flowerName; 1/ Print flower name using the following format //cout var "grows in the " var2 endl; fin.close(); return ; \} /l End of main function Flowers.cpp flowers.dat 1. Astilbe 2 Shade 3 Marigold 4 Sun 5 Begonia 6 Sun 7 Primrose 8 Shade 9 Cosmos 10. Sun 11 Dahlia 12 Sun 13 Geranium 14 Sun 15 Foxglove 16 Shade 17 Trillium 18 Shade 19 Pansy 20 Sun 21. Petunia 22 Sun 23 Dasy 24 Sun 25 Aster 26 Sun 27
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
