//Barb Sanchez // writing numeric data to a file //9-10-02 #include <iostream> #include <fstream.h> // for file I/O int main() { float x; ofstream my_file; my_file.open("floats.dat", ios::out); //open file for data if (my_file) //if no problems with data file { cout << "\nEnter a series of numbers."; cout << "\nEnter a zero (0) to end the series"; do { cin >> x; //get number my_file<< x << endl; //add to data file } while (x!=0.0); } //if else { cout << "Error opening file"; } my_file.close(); return 0; } //end of main