Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Additionally, the code pattern for opening the input file has been implemented: fin.open(flowers.dat);. Finally, the code pattern for using a while loop to read input

Additionally, the code pattern for opening the input file has been implemented: fin.open("flowers.dat");. Finally, the code pattern for using a while loop to read input from the file has been implemented: while (fin >> flowerName >> grown). With these modifications, the program should now be able to read input from the flowers.dat file and print the flower names and where they can be grown.

*******************Made Modifications and still have same error message... what else can we do?

#include

#include

#include

using namespace std;

int main()

{

// Declare variables here

string flowerName;

string grown;

// Open input file

ifstream fin

fin.Open("flowers.dat");image text in transcribed

// Check if file was successfully opened

if (!fin)

{

cout

return 1;

}

// Read input from file

while (fin >> flowerName >> grown)

{

// Print flower name and where it can be grown

cout

}

// Close file

fin.close();

return 0;

} // End of main function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago