wont compile,
keep getting these error messages (prog. below)
In function `void calculate_Bill(double&, double&, double&, double&)':
expected `}' at end of input
expected `while' at end of input
`(' at end of input
expected primary-expression at end of input
#include <iostream>
using namespace std;
void calculate_Bill (double&, double&, double&, double&); //prototype
void printBill (double, double, double, double); //prototype
int main () //main function
{
double num_items;
double total_cost, least_exp, most_exp;
calculate_Bill (num_items, total_cost, least_exp, most_exp);
//calls calculate_Bill
system ("PAUSE");
return 0; //end main function
}
void calculate_Bill (double& num_items, double& total_cost, double& least_exp, double& most_exp)
{
int cost_item;
char answer = 'n';
num_items = 0;
total_cost = 0;
least_exp = cost_item;
most_exp = 0;
do
{
const int COST = 0;
int i, array[COST];
for(i = 0; i < COST; i++) //populate the array with user input
{
cout<<"Please enter the cost of item#" <<array <<" (zero or negative # to exit): $";
cin>>array;
}
while (cost_item > 0)
{
total_cost = total_cost + cost_item;
if (cost_item < least_exp)
least_exp = cost_item;
if (cost_item > most_exp)
most_exp = cost_item;
const int COST = 0;
int i, array[COST];
for(i = 0; i < COST; i++) //populate the array with user input
{
cout<<"Please enter the cost of item#" <<array <<" (zero or negative # to exit): $";
cin>>array;
}
num_items--;
printBill (num_items, total_cost, least_exp, most_exp); //calls printBill
num_items = 0;
cout<<"Would you like to continue with the next customer?";
cin>>answer;
}
while (answer == 'y' || answer =='Y');
cout<<endl;
//end calculate Bill
{
void printBill (double num_items, double total_cost, double least_exp, double most_exp);
{
if (total_cost >= 500)
cout<<"STOP...Please show the sales associate your ID before you check out!"<<endl;
cout<<endl;
}
cout<<array<<endl;
cout<<"-------------------------------------------"<<endl;
cout<<"Number of items: "<<num_items<<endl;
cout<<"Total cost of all items: $"<<total_cost<<endl;
cout<<"Least expensive item: $"<<least_exp<<endl;
cout<<"Most expensive item: $"<<most_exp<<endl;
cout<<"-------------------------------------------"<<endl;
cout<<endl;
keep getting these error messages (prog. below)
In function `void calculate_Bill(double&, double&, double&, double&)':
expected `}' at end of input
expected `while' at end of input
`(' at end of input
expected primary-expression at end of input
#include <iostream>
using namespace std;
void calculate_Bill (double&, double&, double&, double&); //prototype
void printBill (double, double, double, double); //prototype
int main () //main function
{
double num_items;
double total_cost, least_exp, most_exp;
calculate_Bill (num_items, total_cost, least_exp, most_exp);
//calls calculate_Bill
system ("PAUSE");
return 0; //end main function
}
void calculate_Bill (double& num_items, double& total_cost, double& least_exp, double& most_exp)
{
int cost_item;
char answer = 'n';
num_items = 0;
total_cost = 0;
least_exp = cost_item;
most_exp = 0;
do
{
const int COST = 0;
int i, array[COST];
for(i = 0; i < COST; i++) //populate the array with user input
{
cout<<"Please enter the cost of item#" <<array <<" (zero or negative # to exit): $";
cin>>array;
}
while (cost_item > 0)
{
total_cost = total_cost + cost_item;
if (cost_item < least_exp)
least_exp = cost_item;
if (cost_item > most_exp)
most_exp = cost_item;
const int COST = 0;
int i, array[COST];
for(i = 0; i < COST; i++) //populate the array with user input
{
cout<<"Please enter the cost of item#" <<array <<" (zero or negative # to exit): $";
cin>>array;
}
num_items--;
printBill (num_items, total_cost, least_exp, most_exp); //calls printBill
num_items = 0;
cout<<"Would you like to continue with the next customer?";
cin>>answer;
}
while (answer == 'y' || answer =='Y');
cout<<endl;
//end calculate Bill
{
void printBill (double num_items, double total_cost, double least_exp, double most_exp);
{
if (total_cost >= 500)
cout<<"STOP...Please show the sales associate your ID before you check out!"<<endl;
cout<<endl;
}
cout<<array<<endl;
cout<<"-------------------------------------------"<<endl;
cout<<"Number of items: "<<num_items<<endl;
cout<<"Total cost of all items: $"<<total_cost<<endl;
cout<<"Least expensive item: $"<<least_exp<<endl;
cout<<"Most expensive item: $"<<most_exp<<endl;
cout<<"-------------------------------------------"<<endl;
cout<<endl;