// Flowers.cpp - This program reads names of flowers and whether they are grown in shade or sun from an input
// file and prints the information to the user's screen.
// Input: flowers.dat.
// Output: Names of flowers and the words sun or shade.
#include <fstream>
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
// Declare variables here
ifstream fin;
string flowerName;
string flowerGrow;
// Open input file
fin.open("flowers.dat");
fin >> flowerName;
fin >> flowerGrow;
while (!fin.eof())
// Write while loop that reads records from file.
{
fin >> flowerName;
fin >> flowerGrow;
// Print flower
cout << flowerName <<endl;
cout << flowerGrow <<endl;
}
fin.close();
return 0;
} // End of main function
okay it is printing out all of the items except the first 5 things
Astilbe
Shade
Marigold
Sun
Begonia doesnt print anything above the line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
sun starts printing out here
Primrose
Shade
Cosmos
Sun
Dahlia
Sun
Geranium
Sun
Foxglove
Shade
Trillium
Shade
Pansy
Sun
Petunia
Sun
Daisy
Sun
Aster
Sun