here's the code
Code:
#include<stdio.h>
#define basic_cost 5.00
#define cost_1000_liter 1.10
#define fine 2.00
float calc_usage_cost(int , int );
float calc_unpaid_cost(float );
float calc_total_bill( float, float);
void print_bill(int ,float);
int main()
{
int prev_meter , cur_meter , act_num;
float unpaid_bill, usage, unpaid, total, collection=0;
char choice;
printf("------------------Perlis Water----------------");
printf("this program generates monthly water bill");
printf("------------------------------------------------------");
do
{
printf("Enter account number:");
scanf("%d", &act_num);
printf("enter unpaid bill :");
scanf("%f", &unpaid_bill );
printf("Enter previous and current meters :");
scanf("%d%d", &prev_meter, &cur_meter);
usage = calc_usage_cost(prev_meter , cur_meter);
unpaid = calc_unpaid_cost(unpaid_bill);
total = calc_total_bill( usage , unpaid );
print_bill(act_num, total);
collection = collection + total;
printf("Do you wish to continue:");
scanf("%c", &choice);
} while((choice == 'y' ) || (choice == 'Y'));
printf("Perlis water collection : %.2f", collection);
return 0;
}
float calc_usage_cost(int prev, int cur )
{
float water_usage, usage_cost;
water_usage = cur - prev;
usage_cost = (water_usage/1000) * cost_1000_liter;
return(usage_cost);
}
float calc_unpaid_cost(float unpaid)
{
float unpaid_cost;
if (unpaid >0)
unpaid_cost = unpaid + fine;
else
unpaid_cost = 0;
return(unpaid_cost);
}
float cal_total_bill( float usage_cost, float unpaid_cost)
{
float total_bill;
total_bill = basic_cost + usage_cost + unpaid_cost;
return(total_bill);
}
void print_bill(int act_num ,float total_bill)
{
printf("\n\nYour account number is %d \n", act_num);
printf("Your total bill is RM %5.2f\n", total_bill);
}
got this error when execute :
Building function2.obj.
Building lab.exe.
POLINK: error: Unresolved external symbol 'calc_total_bill'.
POLINK: fatal error: 1 unresolved external(s).
*** Error code: 1 ***
Done.
so what's the problem ?