getting some erros for this program


int main()
{
RetailItem toCheck;
LoyaltyAccount cCard, customer, addLoyalRecord;
CashRegister teller =RetailItem retItemObj[10];// CashRegister();
customerDB loyalDatabase;

//temporary variable
string recipt = "HiLo Food Stores\n Scarborough Lower Town, Tobago";
string inName, inNo, inDes, llname, lNo, lfname, uNO;
double iCost, subTo, tCost, eTax;
int iQty, lPts;

ifstream readLoyalC;
ifstream readCart;

readLoyalC.open("customerData.txt",ios::in);
readCart.open("ShoppingCart.txt",ios::in);

if(readLoyalC.is_open() && readCart.is_open())
{
/********** Populate the Customer Database*******************/
//read the first record and the database
readLoyalC>>lNo;
readLoyalC>>llname;
readLoyalC>>lfname;
readLoyalC>>lPts;

LoyaltyAccount cCard = LoyaltyAccount(lNo,llname,lfname,lPts);//error
customerDB loyalDatabase = customerDB (cCard);

while(!readLoyalC.eof())
{
readLoyalC>>lNo;
readLoyalC>>llname;
readLoyalC>>lfname;
readLoyalC>>lPts;

cCard = LoyaltyAccount(lNo,llname,lfname,lPts);

//add to database
loyalDatabase.addLoyalRecord(cCard);
}//end

{
/**** populate CashRegister******/

while(readCart.eof())
{
getline(readCart, inNo, '#');
getline(readCart, inDes, '#');
readCart>>iCost;
readCart>>iQty;

//initialise with data from file
toCheck = RetailItem(inNo, inDes, iCost, iQty);

// add to database
teller.addRetailItem(toCheck, iQty);
} //end of populating the cash register

/*calulate the values for the bill*/
subTo = teller.getSubTotal();
eTax = teller.getTax();
tCost = teller.getTotal();


/** formulate bill and print **/

cout<<"Please enter the shopper's Loyalty Card Number: ";
cin>>uNO;

/* print bill header */
cout<<endl<<billHeader;

if (loyalDatabase.setverifyAc())
{
LoyaltyAccount customer = loyalDatabase.setallInfo();
cout<<customer.getlastName()<<"\t"<<customer.getfirstName();
cout<<endl<<customer.getaccountNum()<<endl;

cout<<"Current Year Balance Points: "<<customer.gettotalPoints();
}
else
{

cout<<"Please apply instore of a Shopper's Card"<<endl;

/*print listing for the bill*/
cout<<"--------------------------------------------------------"<<endl;
teller.retItemObj[10];
cout<<"--------------------------------------------------------"<<endl;

/* print values on the bill */
cout<<"Taxable Sales\t\t"<<subTo;
cout<<"VAT on Sales\t\t"<<eTax;
cout<<"TOTAL SALES\t\t"<<tCost;
} // end of file opened succesfully
else
{
cout<<endl<<"Files could not be opened. APPLICATION TERMINATING";
return -1;
}
//cal the total


return 0;

}//end main


i wrote this code to display a shop
am getting error
error no matching function for call 'RetailItem::RetailItem()
so can any one example or help with the error
Last edited on
You probably declared a constructor for RetailItem with some arguments. If you did that, the default constructor (RetailItem::RetailItem()) is not automatically created. Your first line on main creates a RetailItem calling its constructor with no arguments.
cool i see it. thanks
another error come as well
error no matching function for call to 'LoyaltyAccount::LoyaltyAccount ( std::string&,

can some explain because i have about 6 different ones on that same level
Topic archived. No new replies allowed.