Question: Companion y How to Use the Code Editor Select the Run Code button to execute the program. Select the Calculate Grade button to generate a

Companion y
How to Use the Code Editor
Select the "Run Code" button to execute the program.
Select the "Calculate Grade" button to generate a score based on the completed tasks.
Continue to modify, run, and calculate your code until you are happy with the grade.
Select the "Submit" button to turn in the assignment to your instructor.
Your Tasks
In this lab, you will open a file, flowers.dat, and read input from that file in a pre-written C++ program. The program should read and print the names of flowers and whether they are grown in shade or sun.
Companion x
Instructions
E. Task 1: Write the C++ statements that will open the input file, flowers.dat, for reading.
Task 3: Write a while loop to read the input until EOF is reached. In the body of the loop, print the name of each flower and where it can be grown (sun or shade).
An example of the program is shown below:
Astilbe is grown in the Shade Marigold is grown in the Sun Begonia is grown in the Sun Primrose is grown in the Shade Cosmos is grown in the Sun Dahlia is grown in the sun Geranium is grown in the Sun Foxglove is grown in the Shade Trillium is grown in the shade Pansy is grown in the Sun Petunia is grown in the Sun Daisy is grown in the Sun Aster is grown in the Sun
// file and prints the information to the user's screen.// Input: flowers.dat.// Output: Names of flowers and the words sun or shade.1718#include
22int main()earch26e zebra4NDeclare variables hereOpennput fileWrite while loop that reads reconds from file.fin flowenNamesPrint fouen name
Companion y How to Use the Code Editor Select the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!