Hello,
I am new at this. I am trying to work with calling functions here. (Eventually I want to do some simple calcs on cost of going through a station...)but am getting an error on line marked with *****
initialise line within main int(). Can someone kindly suggest why it gives me error: "invalid initialisation of reference of type 'double&' from expression of type 'float'. (I have checked that all my function floats and doubles match up correctly)....

Thanks in advance for your help.

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

void initialise(float&, double& ,int& ,int& ,bool&);
void printPageHeadings(int&, int&);
void readRecord (int&, string& , int&, float&, int&, bool&);
void printControlCost(string, float& , int& );
void processRecord(int ,string ,int,float,int ,float& ,float&,int);
void printDetailLine (int ,string ,int ,float ,int ,float , int&);
void resetControlTotals(float&);
void accumulateTotals(float , float&, float& );

const int MAX_DETAIL_LINES =100;
void initialise(float& controlTotal,double& invoiceTotal,int& pageCount,int& lineCount,bool& more)
{
controlTotal = 0;
invoiceTotal = 0;
pageCount = 0;
lineCount = 0;
more= true;
}

void printPageHeadings(int& pageCount, int& lineCount)
{
     pageCount = pageCount +1;
     cout<<"TAG\tPERSON'S\tSTATION"
     <<"\t\t\t\t\n";
     cout<<"ID\tNAME\t\tID\t\tCOST\t\QTY\tAMOUNT\n\n";
     
     lineCount = 4;
     }
     
void readRecord (int& id, string& name, int& item, float& cost, int& qty, bool& more)
{
     cerr<<"-->";
     cin>>id>>name;
     cin>>item>>cost>>qty;
     more =! cin.fail() && id;
     //validateName(name);
     }
     
//void validateName(string name)
//{
  //   static string pad= "     ";
    // name = name + pad + pad +pad;
     //name= name.substr(0,3*TABWIDTH-1);
     //}
     
void printControlCost(string prevName, float& controlTotal, int& lineCount)
{
     cout<<"\t\tTotal Cost for "<<prevName;
     cout<<"\t$"<<controlTotal<<"\n\n";
     lineCount = lineCount + 2;
     resetControlTotals(controlTotal);
     }
     
void processRecord(int id,string name,int item,float cost,int qty,float& controlTotal,float& invoiceTotal,int lineCount)
{
     float amount;
     amount = cost * qty;
     printDetailLine (id, name, item, cost, qty, amount, lineCount);
     accumulateTotals(amount, controlTotal, invoiceTotal);
}

void printDetailLine (int id,string name,int item,float cost,int qty,float amount, int& lineCount)
{
     cout<<id<<"\t\t"<<name<<"\t"
     <<item<<"\t$"<<cost<<"\t"
     <<qty<<"\t$"<<amount<<"\n";
     lineCount++;
     }
     
void resetControlTotals(float& controlTotal)
     
     {
     controlTotal = 0;  
     }

void accumulateTotals(float amount, float& controlTotal, float& invoiceTotal)
     {
     controlTotal =controlTotal + amount;
     invoiceTotal = invoiceTotal + controlTotal;
     }
                
int main()
{
    
    int id;
    string name;
    int item;
    float cost;
    int qty;
    bool more;
    float controlTotal;
    float invoiceTotal;
    int pageCount;
    int lineCount;
    int prevId;
    string prevName;
    
    *********initialise (controlTotal, invoiceTotal, pageCount, lineCount, more);
    printPageHeadings(pageCount, lineCount);
    readRecord(id, name, item, cost, qty, more);
    prevId =id;
    prevName=name;
    while(more)
    {
               if (id!=prevId)
              printControlTotalCost(prevName, controlTotal, lineCount);
               prevId= id;
              prevName = Name;
               }
               if (lineCount >MAX_DETAIL_LINES)
               printPageHeadings(pageCount, lineCount);
               precessRecord(id, name, item, cost, qty, controlTotal, invoiceTotal, lineCount);
               readRecord(id, name, item, cost, qty, more);
               
               printControlTotalCost(prevName, controlTotal, lineCount);
               printReportTotals(invoiceTotal);
               
               system("pause");
               return 0;
               }

It's telling you to look at this.

void initialise(float&, double& ,int& ,int& ,bool&);
float controlTotal;
float invoiceTotal;
/*********/initialise (controlTotal, invoiceTotal, pageCount, lineCount, more);

Incidentally, using comments would allow me to run it into a compiler without editing it. Favors such as this (not requiring others to edit out what is not actually in your code) will help get responses. There should be several lines about this in the commenting section of programming texts... [edit]No, wait. I'm dreaming now.[/edit]

Thanks for your time Dave.
I will comment out any "extra" stuff next time.

Recommendation:

Unless you must leave floats and doubles in the program, settle on one or the other. Doubles would be best.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.