below is the assignment question... n below that is my solution but its bugged. any hints would be greatly appreciated.

Interstate Motorway Pty Limited requires you to design a program that will produce customer statements for passing through E-way checkpoints of four toll stations (denoted by A, B, C and D respectively) distributed on the nationwide motorway. The charge of each pass is specified as follows
Station A B C D
Charge $2.20 $2.80 $2.30 $3.80

These statements will be calculated from the checkpoint log file of the format
3435344 A 2005/02/22/08:22:41
4749038 A 2005/02/25/14:16:35
5186936 C 2005/02/28/08:34:53
3873242 D 2005/03/02/02:40:59
4749038 A 2005/03/05/14:16:35
4092191 A 2005/03/08/23:49:08
3435344 C 2005/03/11/08:22:41
4092191 C 2005/03/14/23:42:08
4749038 D 2005/03/17/14:16:35
3435344 A 2005/03/20/08:22:41
...
where the first column contains customer ids, the second column contains the toll stations and the last column contains the timestamps. Hence the first record in the above, for instance, indicates that the vehicle with tag number (i.e. customer id) 3435344 passed through toll station A at time 08:22:41 on 22nd February 2005.
In order that each statement carries also the customer's name and address, the address file will be provided in the form of
3435344 @ L Brooks,12 Shaftsbury Road,Burwood NSW 2134
3873242 @ N McGoldrick,8 Colless Place,South Melbourne VIC 3205
4092191 @ T Peachey,32 Evan Street,Penrith NSW 2750
4749038 @ D Merritt,70 Albert Street,Werrington NSW 2747
4967987 @ R Bailey,102-47 Pardalote Avenue,Glenmore Park NSW 2745
5186936 @ S Galloway,8-121 Coreen Road,Scoresby VIC 3179
...
For the convenience of processing the log file for the statements, the address file and the log file will be first merged and then sorted line by line alphabetically to generate the toll data file, which will thus look like
3435344 @ L Brooks,12 Shaftsbury Road,Burwood NSW 2134
3435344 A 2005/02/22/08:22:41
3435344 A 2005/03/20/08:22:41
3435344 B 2005/03/23/18:22:41
3435344 B 2005/04/10/28:22:41
3435344 C 2005/03/11/08:22:41
3435344 C 2005/05/10/14:22:41
3435344 C 2005/05/19/06:22:43
3435344 D 2005/05/01/01:26:41
3873242 @ N McGoldrick,8 Colless Place,South Melbourne VIC 3205
3873242 B 2005/03/29/02:40:59
3873242 B 2005/05/16/02:40:59
3873242 C 2005/04/07/22:40:59
3873242 D 2005/03/02/02:40:59
...
For instance, if an address file address.txt is mergered with a log file logfile.txt into a combined file combined.txt, then sorting the combined file will generate the needed toll data file tolldata.txt. Hence in this assignment, we will always assume that the input data are in the form of toll data file and simply forget about the existence of the log file and the address file.
In this assignment, you are required to design an algorithm in pseudocode for the solution of the problem and get it implemented in C++. Your implemented C++ program toll.cpp will read data in the format of the toll data file, i.e.
o customer id as a word
o toll station or '@' as a character
o customer address or timestamp as the rest of the line
calculate the total toll charged for each customer, and produce an invoice statement for each customer who has a non-zero balance. A statement for each customer should include the following information
4. Heading
5. Customer's id, name and address
6. Column heading: Date, Time, Station, Amount
7. All records charged to the customer
8. Total amount the customer owned in the statement
We note that if your program toll.cpp is compiled into toll.exe and the toll data file is tolldata.txt, then using piping
toll.exe < tolldata.txt > statements.txt
should generate precisely the list of toll statements satisfying the above requirements. This means if you are using prompts for interative data input, you need to make sure that the prompts are sent to standard error device using cerr (instead of cout). This way, the prompts will not be piped into the output file statement.txt.

below is my solution...

Code:
#include <iostream>
#include <string.h>
using namespace std;

void print_main_Heading(int&, int&);
void print_Column_Heading(int&, int&);
void readtolldetails (int& , int& , string& , string& , string& ,int& , int& );
void calculateToll(int& , char& , int& , float& , float& , float& , float& );
void resetContotals(double&);
void printTotalInvoice (const int& , char& , float& , float& , float& , float& , float& );

const int MAX_LINES =100;
const int MAX_LINE = 100;
const int MAX_SIZE = 20;
double TotalInvoice = 0;
int pageCount = 0;
int lineCount = 0;
bool more = true;

void print_main_Heading(int& pageCount, int& lineCount)
{
     pageCount = pageCount +1;
     cout<<"Interstate motorway tax invoice"<<endl;
     cout<<"cutomer id\tname\address" ;
     lineCount = 2;
     }
     
void printCustomerHeading(int& pageCount, int& lineCount)
{
     pageCount = pageCount +1;
   
     cout<<"DATE\t\tTIME\tAMOUNT\n\n";
     
     lineCount = 1;
     }

void readtolldetails (int& MAX_LINE, int& MAX_SIZE, string& date, string& time, string& ipString,int& i, int&gate)
{
    
    date [MAX_SIZE];
    time [MAX_SIZE];
    ipString;
  i =0;
    
    do {
        cerr<<"proceeding... "<< endl;
        getline(cin, ipString);   
        if(cin.fail()) break;  
        
        int position = ipString.find ('/');
        date [i] = ipString.substr(0,10); 
        time [i] = ipString.substr(11,16-11);   
        i++;
        }
        while (i<MAX_SIZE);
        
        for (int j=0; i<j; i++)
        cout <<date[j]<<"\t"<<time[j]<<endl;
                      
}
  void calculatetoll (string& station, int i, float& a, float& b, float& c, float&d,float& total, double& contotal)
{  
   a = 0;
   b = 0;
   c = 0;
   d = 0;
    
   int j = 0;
   do
   {
      
       if (station [j] == "A")
       {               
                   a= a + 2.20;
                   cout<<a;
       }

     else if(station[j] == " B")
     {               
                   b= b + 2.80;
                   cout<<b;
       }
        else if(station[j] == "C")
     {               
                 c= c + 2.30;
                   cout<<c;
       }
        else if(station[j] == "D")
     {               
                   d= d + 3.80;
                   cout<<d;
       }
       
        total = a + b+ c + d;
 cout<<"TOTAL: " << total << endl;

 cout<<"please make payment as soon as possible."<< endl;
 resetContotals(contotal);
 
       
  }
  while(j < i);
}
     
     void resetContotals(double& contotal)
     
     {
     contotal = 0;  
     }



int main ()
{
int currentid;
int previd;
string custid;
string prevcustid;

double contotal;
int pageCount;
int lineCount;
char station;
int i;
float a, b, c, d, total;
string ipstring;

previd =currentid;
prevcustid=custid;
         while(more)
         {
               if (currentid!=previd)
               calculateToll (MAX_SIZE, station, i , a , b, c, d); 
               previd= currentid;
               prevcustid= custid;
               }
               if (lineCount >MAX_LINES)
               print_main_Heading(pageCount, lineCount);
               print_Column_Heading(pageCount, lineCount);
               readtolldetails (MAX_LINE, MAX_SIZE,ipString, i); 
               calculateToll(MAX_SIZE, station, i, a, b, c, d );
               printTotalInvoice (MAX_SIZE, station, a, b, c, d, total);

               system("pause");
               return 0;
}