vacantstare
Technical User
for some reason this program refuses to compile, all the errors seem to occur on the "Dsicount" function when i can`t see any, any comments ideas would be greatly appreciated #include <stdio.h>
//funtion prototypes
void Cost_of_Purchase(float *pcost); //enter price of items
float Discount(float *pcost); //discount using required percentage
void Output_Bill(float,float); //output final values
void HoldScreen(void);
#define disc_1 = 0.08;
#define disc_2 = 0.10;
#define Limit = 100;
void main (void)
{
//declare variables
float cost;
float discounted_amount;
Cost_of_Purchase(&cost);
discounted_amount = Discount(&cost);
Output_Bill(cost, discounted_amount);
Holdscreen();
}
//input costs
void Cost_of_Purchase(float *pcost)
{
float price;
float cost;
int qty;
puts("Enter the following for item required"
printf("\tPrice of item"
scanf(" %d", price);
printf("Quantity required"
scanf(" %d", qty);
cost = qty * price;
}
//discount
float Discount(float *pcost)
{
float amount;
if (*pcost <= Limit)
amount = disc_1 * *pcost;
else
amount = disc_2 * *pcost;
return amount;
}
//output relavant amounts
void Output_Bill(float cost, float discounted_amount)
{
float discounted_cost;
discounted_cost = cost - discounted_amount;
printf("Cost of goods purchased....%10.2d", cost);
printf("Amount of discount....%10.2d", discounted_amount);
printf("Cost of goods purchased....%10.2d", discounted_cost);
}
void HoldScreen(void)
{
printf("\n\n\tPress ENTER to finish"
fflush(stdin);
getchar();
}
//funtion prototypes
void Cost_of_Purchase(float *pcost); //enter price of items
float Discount(float *pcost); //discount using required percentage
void Output_Bill(float,float); //output final values
void HoldScreen(void);
#define disc_1 = 0.08;
#define disc_2 = 0.10;
#define Limit = 100;
void main (void)
{
//declare variables
float cost;
float discounted_amount;
Cost_of_Purchase(&cost);
discounted_amount = Discount(&cost);
Output_Bill(cost, discounted_amount);
Holdscreen();
}
//input costs
void Cost_of_Purchase(float *pcost)
{
float price;
float cost;
int qty;
puts("Enter the following for item required"
printf("\tPrice of item"
scanf(" %d", price);
printf("Quantity required"
scanf(" %d", qty);
cost = qty * price;
}
//discount
float Discount(float *pcost)
{
float amount;
if (*pcost <= Limit)
amount = disc_1 * *pcost;
else
amount = disc_2 * *pcost;
return amount;
}
//output relavant amounts
void Output_Bill(float cost, float discounted_amount)
{
float discounted_cost;
discounted_cost = cost - discounted_amount;
printf("Cost of goods purchased....%10.2d", cost);
printf("Amount of discount....%10.2d", discounted_amount);
printf("Cost of goods purchased....%10.2d", discounted_cost);
}
void HoldScreen(void)
{
printf("\n\n\tPress ENTER to finish"
fflush(stdin);
getchar();
}