I/O files, functions,error checking

Hi guys, I have to write a program that does the following:

Write a program that reads data from an input file named “input.txt”, and produces two output files named “report.txt” and “error.txt”. The input file contains data needed to generate a report of electric customers’ bills. The report will be the first output file. The second output file will be an error file.

The input file will be laid out with the following information, each on a separate line:
1. Customer First Name
2. Customer Last Name
3. Old Meter Reading
4. New Meter Reading

The following are the reasons that a customer should be written to the error file:
1. A meter reading not valid number in range 0 – 9999
2. A name left blank

The report file should be laid out, neatly arranged in columns, with the following:
Last Name, First Name Amount Owed
Note: each unit costs 20 cents

The error file should be laid out, neatly arranged in columns, with the following:
Last Name, First Name Old Meter New Meter






This is what I have so far.
//Main.cpp


#include <iostream>
#include "customer.h"
#include <fstream>

using namespace std;

int main(void)
{
ifstream inData;
ofstream outData1;
ofstream outData2;

Customer customer1;

inData.open("input.txt");
outData1.open("report.txt",ios::out);
outData2.open("error.txt",ios::out);

string firstLine;
string secondLine;
int thirdLine;
int fourthLine;

while (!inData.eof())
{
getline(inData, firstLine, '\n');
getline(inData, secondLine, '\n');
getline(inData, thirdLine, '\n');
getline(inData, fourthLine, '\n');
}

customer1.setfirstName();
customer1.setlastName();
customer1.setoldRead();
customer1.setnewRead();
customer1.display();

inData.close();
outData1.close();
outData2.close();

system("PAUSE");
return 0;
}

//Customer.h file

#ifndef CUSTOMER_H
#define CUSTOMER_H

class Customer
{
public:
// CONSTRUCTOR
Customer();

// MODIFICATION MEMBER FUNCTIONS
void setfirstName (const string);
void setlastName(const string);
void setoldRead (const int);
void setnewRead (const int);

// CONSTANT MEMBER FUNCTIONS
string getfirstName (void) const;
string getlastName(void) const;
int getoldRead (void) const;
int getnewRead (void) const;
void display (void) const;

private:
string firstName;
string lastName;
int oldRead;
int newRead;
};

#endif


I'm not sure what to do next, or which direction to go. I'm still new to c++ so any help would be appreciated.

could you please tell me what is there in system.h??
All I have right now is what I posted. I only have the main.cpp file so far and customer.h files. I posted them both

I haven't created the customer.cpp file yet which will contain all my functions.
Topic archived. No new replies allowed.