So I have a flowers.dat file and my program is to read the .dat file and then I must 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. When I execute the program it does not output anything from my file. It compiles and I used the example in my book to develop the code thus far. Any pointers of where I went wrong would be helpful. I am using 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 <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Declare variables here
string flowerName, flowerTemp;
ifstream data_in;
ofstream data_out;
ofstream data_out; opens a file, but there is no file name. You are throwing away all your output.
Why are you writing the data back out to a file? You are basically copying a file, without creating a copy. Maybe you should output the file to the console screen?
PLEASE use code tags, it makes it easier to read your code (you can edit your post to add them):
How to use code tags
http://www.cplusplus.com/articles/jEywvCM9/