C Programming...help needed

hey guys..
i want to show you my coding...i've got this error on line 63..
the error said that my called object is not a fucntion...
can you guys help me out?...thanks in advance..



#include <stdio.h>
#include <stdlib.h>

float drinks();
float vegetables();
float meats_Fishes();
float snacks();
float discount(float);
float discount_snacks,discount_meats_Fishes,discount_vegetables,Dis_Total;

int main()
{
float Drinks, Snacks, Meats_Fishes, Vegetables, dis_Drinks, dis_Snacks, dis_Meats_Fishes, dis_Vegetables, Total_price,Discount_Total;

printf("\nWELCOME TO PASARAYA BERKAT!");
printf("\nwe are now giving discounts as a form of");
printf("\nappreciation to our beloved customer.");

Drinks = drinks();
Snacks = snacks();
Meats_Fishes = meats_Fishes();
Vegetables = vegetables();

//Dis_Total=dis_Drinks+dis_Meats_Fishes+dis_Snacks+dis_Vegetables;
Total_price=Drinks+Snacks+Meats_Fishes+Vegetables;

Discount_Total=discount(0);
printf("\n\n\nTotal Discount = RM %.2f", Dis_Total);
printf("\n\n\nTotal Price (after discount) = RM %.2f", Total_price);

if (Total_price>50)
{
printf("\n\nYou get another RM5 discount because make purchase more then RM50!");
printf("\nTotal Discount = RM %.2f", Dis_Total+5);
printf("\nTotal Price (after discount) = RM %.2f", Total_price-5);
printf("\n\nThank you! Have a nice day!\n\n\n");
}
else
{
printf("\nThank you! Have a nice day!");
}
}

float drinks()
{
float discount_drinks,drinks,discounted_drinks, discount;
int CocaCola,Sprite,Mirinda_O,Mirinda_a;

printf("\n\n\nWhat DRINKS do you want?");
printf("\nCoca Cola, how many bottle? (0 for 'no, thanks!')");
scanf("%d", &CocaCola);
printf("\nSprite, how many bottle? (0 for 'no, thanks!')");
scanf("%d", &Sprite);
printf("\nMirinda Orange, how many bottle? (0 for 'no, thanks!')");
scanf("%d", &Mirinda_O);
printf("\nMirinda Apple, how many bottle? (0 for 'no, thanks!')");
scanf("%d", &Mirinda_a);

drinks=(CocaCola*3.2)+(Sprite*2.3)+(Mirinda_O*2.4)+(Mirinda_a*2.4);
discount_drinks=(CocaCola*3.2*0.05)+(Sprite*2.3*0.05)+(Mirinda_O*2.4*0.05)+(Mirinda_a*2.4*0.05);
discounted_drinks=drinks-discount_drinks;

Dis_Total=discount(discount_drinks);//LINE 63

printf("discount for drinks= RM %.2f", discount_drinks);

return discounted_drinks;
}

float snacks()
{
float snacks,discount_snacks,discounted_snacks;
int Twisties,Super_ring,Rota;

printf("\n\n\nWhat SNACKS do you want?");
printf("\nTwisties, how many packet? (0 for 'no, thanks!')");
scanf("%d", &Twisties);
printf("\nSuper Ring, how many packet? (0 for 'no, thanks!')");
scanf("%d", &Super_ring);
printf("\nRota, how many packet? (0 for 'no, thanks!')");
scanf("%d", &Rota);


snacks=(Twisties*3.3)+(Super_ring*1.8)+(Rota*1.8);
discount_snacks=(Twisties*3.3*0.05)+(Super_ring*1.8*0.05)+(Rota*1.8*0.05);
discounted_snacks=snacks-discount_snacks;

Dis_Total=discount(discount_snacks);
printf("discount for snacks= RM %.2f", discount_snacks);

return discounted_snacks;
}

float meats_Fishes()
{
float meats_Fishes,discount_meat_fishes,discounted_meat_fishes;
int Beef,Mutton,Chicken,Salmon,Catfish;

printf("\n\n\nWhat MEAT AND FISHES do you want?");
printf("\nBeef, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Beef);
printf("\nMutton, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Mutton);
printf("\nChicken, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Chicken);
printf("\nSalmon, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Salmon);
printf("\nCatfish, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Catfish);


meats_Fishes=(Beef*2)+(Mutton*2.5)+(Chicken*1.3)+(Salmon*10)+(Catfish*1.5);
discount_meat_fishes=(Beef*2*0.1)+(Mutton*2.5*0.1)+(Chicken*1.3*0.1)+(Salmon*10*0.1)+(Catfish*1.5*0.1);
discounted_meat_fishes=meats_Fishes-discount_meat_fishes;

Dis_Total=discount(discount_meat_fishes);
printf("discount for Meat and Fishes= RM %.2f", discount_meat_fishes);

return discounted_meat_fishes;
}

float vegetables()
{
float vegetables,discount_vegetables,discounted_vegetables;
int Cabbage,Spinach,Cucumber;

printf("\n\n\nWhat Vegetables do you want?");
printf("\nCabbage, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Cabbage);
printf("\nSpinach, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Spinach);
printf("\nCucumber, how many gram? (0 for 'no, thanks!')");
scanf("%d", &Cucumber);


vegetables=(Cabbage*0.3)+(Spinach*0.5)+(Cucumber*0.45);
discount_vegetables=(Cabbage*0.3*0.03)+(Spinach*0.5*0.03)+(Cucumber*0.45*0.03);
discounted_vegetables=vegetables-discount_vegetables;

Dis_Total=discount(discount_vegetables);
printf("discount for vegetables= RM %.2f", discount_vegetables);

return discounted_vegetables;
}

float discount(float a)
{
Dis_Total=Dis_Total+a;
return Dis_Total;
}

You declared discount to be a local variable at line 46.
The local variable takes precedence over the global function.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
Topic archived. No new replies allowed.