Opening Files and Performing File Input in C++ // Flowers.cpp - This program reads names of flowers and whether they are grown in shade or sun from an input...


Opening Files and Performing File Input in C++



// 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 

#include 

#include 

using namespace std;

int main()

{

   // Declare variables here


   // Open input file



   // Write while loop that reads records from file.

   fin >> flowerName;


      // Print flower name using the following format

      //cout <><><><>


   fin.close();

   return 0;

} // End of main function


Next tab:

Astilbe
Shade
Marigold
Sun
Begonia
Sun
Primrose
Shade
Cosmos
Sun
Dahlia
Sun
Geranium
Sun
Foxglove
Shade
Trillium
Shade
Pansy
Sun
Petunia
Sun
Daisy
Sun
Aster
Sun

Opening Files and Performing File Input in C++<br>Tasks<br>Flowers.cpp<br>>- Terminal<br>flowers.dat<br>Description<br>1 // Include the necessary header files<br>Astilbe grows in the Shade<br>Marigold grows in the Sun<br>Begonia grows in the Sun<br>2<br>Searched your code for a specific pattern:<br>fin.open.+\b+\W+.$<br>3 #include <fstream><br>4<br>Primrose grows in the Shade<br>Cosmos grows in the Sun<br>Dahlia grows in the Sun<br>5 #include <iostream><br>6<br>You can learn more about regular expi<br>7 #include <string><br>Geranium grows in the Sun<br>8.<br>Foxglove grows in the Shade<br>Trillium grows in the Shade<br>9 #include <stdlib.h><br>10<br>Pansy grows in the Sun<br>Petunia grows in the Sun<br>Code Pattern • Incomplete<br>11 using namespace std;<br>Program uses while loop<br>12<br>Daisy grows in the Sun<br>Aster grows in the Sun<br>13 // Define the main() function<br>14<br>15 int main()<br>Description<br>Searched your code for a specific pattern:<br>while.+\W.fin.+eof.+<br>16<br>17 {<br>18<br>You can learn more about regular expi<br>19 // Create an ifstream object<br>20<br>21 ifstream fin;<br>22<br>23 // Declare two string variables to store the<br>24<br>Program outputs successfully<br>25 // flower's name and where the flower grows<br>10.00<br>out of<br>26<br>flowerleme<br>Run checks<br>A Submit 75%<br>

Extracted text: Opening Files and Performing File Input in C++ Tasks Flowers.cpp >- Terminal flowers.dat Description 1 // Include the necessary header files Astilbe grows in the Shade Marigold grows in the Sun Begonia grows in the Sun 2 Searched your code for a specific pattern: fin.open.+\b+\W+.$ 3 #include 4 Primrose grows in the Shade Cosmos grows in the Sun Dahlia grows in the Sun 5 #include 6 You can learn more about regular expi 7 #include Geranium grows in the Sun 8. Foxglove grows in the Shade Trillium grows in the Shade 9 #include 10 Pansy grows in the Sun Petunia grows in the Sun Code Pattern • Incomplete 11 using namespace std; Program uses while loop 12 Daisy grows in the Sun Aster grows in the Sun 13 // Define the main() function 14 15 int main() Description Searched your code for a specific pattern: while.+\W.fin.+eof.+ 16 17 { 18 You can learn more about regular expi 19 // Create an ifstream object 20 21 ifstream fin; 22 23 // Declare two string variables to store the 24 Program outputs successfully 25 // flower's name and where the flower grows 10.00 out of 26 flowerleme Run checks A Submit 75%
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here