File I/O Stream

Hi All,

I am trying to read data from two files and then compare them and only print the records on the screen that have a same ID.i.e TAGNO =CUSTOMERNO
For Eg
My Input Files are (a) Transaction (b) Customer detail
The data in file a is like:
TagNo Date Time Station
4092191 03/08/04 23:49:08 A
4749038 05/04/04 14:16:35 B
4092191 04/13/04 23:42:08 C
4092191 04/13/04 23:47:18 D
3873242 05/16/04 02:40:59 B

Data in File B
CustomerNo Initila Surname Street Suburb State Postcode
4092191 T Menon Evan Penrith NSW 2750
3873242 R Merritt Bent Mosman NSW 2090

Additional Criteria is , if the Grade is A the charges 2.20, B- 2.80, C-3.30 & D -3.80.

The expected output is :
Customer No:
Customer Name:
Address:
details of the transactions:

Customer No Date Time Grade Charges

Below is the code I am trying:

#include <stdlib.h>
#include <fstream.h>
#include <cstring.h>
#include <stdlib.h>
#include <iomanip.h>
void main()
{
string Dt,Tm;
float Charges;
string TagNumber, CustomerNo;
char Station;
string Intial,Surname,StreetNo,StreetName;
//char Intial[2],Surname[10],StreetNo[3],StreetName[20];
char StreetType[20],Surburban[20],State[20],Postcode[5];
float calc_charges( string Station );

//open the files
ifstream InStream\("a:\\trans.txt",ios::in\), InStream1\("a:\\customer.txt",ios::in\);

//  check for Instream File, if the file doesn't exist, print error message
if \(InStream.fail\(\)\)                             // check for success
\{
	cerr &lt;&lt; "\\n Unable to open 'data.txt'!\\n";
	exit \(-1\);                                    //
\} // end if

  if \(InStream1.fail\(\)\)                             // check for success
\{
	cerr &lt;&lt; "\\n Unable to open 'data.txt'!\\n";
	exit \(-1\);                                    //
\} // end if


while \(!InStream.eof\(\)\)                  // while not end-of-file:
\{

			InStream &gt;&gt; TagNumber&gt;&gt;Dt&gt;&gt;Tm&gt;&gt;Station;
			 Charges = calc_charges\( Station \);

	 \} //while\(!input.eof\(\)\);

	 //open the customer detail file

// ifstream InStream1("a:\customer.txt",ios::in);

// if the file doesn't exist, print error message
if \(InStream1.fail\(\)\)                             // check for success
\{
	cerr &lt;&lt; "\\n Unable to open 'customer.txt'!\\n";
	exit \(-1\);                                    //
\} // end if


while \(!InStream1.eof\(\)\)                  // while not end-of-file:
\{

	InStream1 &gt;&gt; CustomerNo&gt;&gt;Intial &gt;&gt; Surname&gt;&gt; StreetNo&gt;&gt; StreetName
	&gt;&gt; StreetType &gt;&gt; Surburban&gt;&gt; State&gt;&gt; Postcode;


	cout &lt;&lt; "\\n Customer Name : " &lt;&lt; Intial &lt;&lt;" " &lt;&lt; Surname &lt;&lt;endl;
	cout &lt;&lt; " Address : " &lt;&lt;StreetNo &lt;&lt; " "&lt;&lt;StreetName &lt;&lt; " " &lt;&lt;StreetType&lt;&lt;endl;
	cout &lt;&lt; Surburban &lt;&lt; " " &lt;&lt;  State &lt;&lt; " " &lt;&lt;  Postcode &lt;&lt;endl;
	cout &lt;&lt; " Customer Number : " &lt;&lt; CustomerNo &lt;&lt;endl;
	cout &lt;&lt;endl;
	cout &lt;&lt; CustomerNo &lt;&lt; "|" &lt;&lt; Dt &lt;&lt; "|" &lt;&lt; Tm &lt;&lt; "|" &lt;&lt;Station
		&lt;&lt; " " &lt;&lt; setw\(4\) &lt;&lt; setiosflags\(ios::fixed\) &lt;&lt; setprecision\(2\)
		&lt;&lt;  Charges &lt;&lt; endl;

}
}

// function definition
float calc_charges( string Station )
{
float the_Charge;
if (Station == 'A')
the_Charge = 2.20;
else if (Station == 'B')
the_Charge = 2.80;
else if (Station == 'C')
the_Charge = 3.30;
else if (Station == 'D')
the_Charge = 3.80;

	return the_Charge;

}

==================
The output that it gives is not correct.

Can someone Please help me out.

Thanks
rooh