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 prewritten C program. The program should read and print the names of flowers and whether they are grown in shade or sun.
Companion
Instructions
E Task : Write the C statements that will open the input file, flowers.dat, for reading.
Task : 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#include
int mainearche zebraNDeclare variables hereOpennput fileWrite while loop that reads reconds from file.fin flowenNamesPrint fouen name
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
