functions undeclared

I keep getting errors stating my variables are not declared, although i seemed to have declared them. anyone have suggestions on what to do?

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;

void readCustomerInfo (string& last_name , double& account_number , char& plan_letter ,
double& minutes_used, double& megabytes_used , ifstream infile);

void display_bills (string& last_name , double& account_number , char& plan_letter,
double& minutes_used, double& megabytes_used, double total, double subtotal, ofstream outfile );

double compute_bills(char plan_letter, double minutes_used, double megabytes_used
,double total, double subtotal);

int main ()
{
ifstream infile;
ofstream outfile;

infile.open("customers.txt");
outfile.open("xxxo.txt");

for (int i = 1; i < 6; ++i)
{
readCustomerInfo(last_name ,account_number , plan_letter ,minutes_used, megabytes_used, infile) ;
compute_bills( plan_letter, minutes_used, megabytes_used, total, subtotal );
display_bills (last_name ,account_number , plan_letter, minutes_used, megabytes_used
total, subtotal );

}




infile.close();
outfile.close();


}

void readCustomerInfo
(string& last_name , double& account_number , char plan_letter,
double& minutes_used, double& megabytes_used, ifstream infile )
{
infile >> last_name >> account_number >> plan_letter >> minutes_used
>> megabytes_used;
}



double compute_bills
(char plan_letter, double minutes_used, double megabytes_used
,double total, double subtotal, ostream outfile )
{
switch(plan_letter)
{
case 'A':
subtotal = 79.99;
if(minutes_used > 450)
{
subtotal = 79.99 + (( minutes_used - 450)*(0.45));
}


case 'B':
total = 50.00;
if(megabytes_used > 500)
{
outfile << "Data speed has been slowed to 2g";
}


case 'C':
subtotal = 28.00;
if(minutes_used > 500)
{
return subtotal = 28.00 + (( minutes_used - 500)*(0.02));
}
if(megabytes_used > 500)
{
return subtotal = 28.00 - (( megabytes_used - 500)*(0.23));
}
}
}




void display_bills
( string& last_name , double& account_number , char& plan_letter,
double& minutes_used, double& megabytes_used, double& total, fstream outfile, double& subtotal )

{
total = subtotal + (subtotal * .20);

outfile << last_name << account_number << plan_letter << minutes_used
<< megabytes_used << subtotal << total;
}
Last edited on
I think you're using the wrong tags for code.

The reason why it says variables are undeclared, is because in your for loop, you call a function that passes data like last_name that you haven't declared anywhere.
Topic archived. No new replies allowed.