Currently the code is like this
Code:
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
void GetFile ( int &, int &, char &, char &, float &, int, int);
ifstream inFile;
ofstream outFile, Errorfile;
int main ()
{
int Adult, Children, Count = 0, Error=0, cError;
char MealType, Weekend, mError, wError;
float Deposit, dError;
inFile.open("C:\\DataFile6D.txt");
if (!inFile)
{
cout << "Error in opening file." << endl;
return 1;
}
while (inFile)
{
GetFile(Adult, Children, MealType, Weekend, Deposit, Error, Count);
}
}
void GetFile (int&Adult, int&Children, char& MealType, char &Weekend, float &Deposit, int Error, int count)
{
while (count <= 5)
{
Errorfile.open ("C:\\Errorfile.out");
inFile >> Adult >> Children >> MealType >> Weekend >> Deposit;
if (Adult < 0)
{
Errorfile << "Number of adults error in record: " << Adult << " " << Children << " " << MealType << " " << Weekend << " " << Deposit << " " << endl;
Error++;
}
if (Children < 0)
{
Errorfile << "Number of childrens error in record: " << Adult << " " << Children << " " << MealType << " " << Weekend << " " << Deposit << " " << endl;
Error++;
}
if (MealType != 'S')
{
if (MealType != 'D')
{
Errorfile << "Meal type error in record: " << Adult << " " << Children << " " << MealType << " " << Weekend << " " << Deposit << " " << endl;
Error++;
}
}
if (Weekend != 'Y')
{
if (Weekend != 'N')
{
Errorfile << "Weekend error in record: " << Adult << " " << Children << " " << MealType << " " << Weekend << " " << Deposit << " " << endl;
Error++;
}
}
if (Deposit < 0)
{
Errorfile << "Deposit error in record: " << Adult << " " << Children << " " << MealType << " " << Weekend << " " << Deposit << " " << endl;
Error++;
}
count++;
}
}
Code:
10 0 S Y 100.00 27 3 D Y 57.50 125 17 D N 0.00 4 0 S N 25.00 0 25 S Y 23.75 250 43 D N 500.00 0 0 D N 0.0 10 0 R Y 10.00 17 3 D R 15.00 5 0 D Y 275.00 -3 10 D Y 20.00 14 -1 S N 30.00 20 3 D Y -10.00
We did the count just to try to run it down 5 rows I believe. We can't get it to read the whole thing @_@
Thanks for the help in advance.

