|
Hello everybody, I'm trying to import a data file, "Junkyard.data", as a stream. It is saved in the same directory/folder as the program I'm writing, yet whenever I try to run my program, I get the error message that I'm supposed to when the opening of the file fails. Can anybody offer any help here?
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
void Header (ofstream& fout);
double Average (int numSalesmen, double cashSum);
void PrintSummary (ofstream& fout);
double Process (ifstream& fin, ofstream& fout);
int main()
{
ifstream fin;
ofstream fout;
double avgSales;
double audiSold;
double bmwSold;
double jagSold;
double lexSold;
double cashSum;
int numSalesmen;
fin.open("Junkyard.data");
if (fin.fail());
{
cout << "ERROR: input file\n";
exit(1);
}
fout.open("Report.out");
if (fout.fail());
{
cout << "ERROR: output file\n";
exit(1);
}
Header(fout);
Process(fin, fout);
Average(numSalesmen, cashSum);
PrintSummary(fout);
.
.
.
.
.
|
|
|
|
|
|
|
|
|
// |