i have to develop this snack machine program that makes you chose a snack put money in and give change here is my code so far, what do i use so the program compare the price and money deposited, I also dont know how to initialize the snack prices and the deposited money.I know i declared and initialized them wrong Thank you so much in advance
char *selection;
double *payment;
int main()
{
char item_cost;
char selection=&item_cost;
double P=1.25,
S=1.35,
T=0.95,
C=1.50,
B=1.75,
N=1.40;
int money;
double payment=&money;
double 1=5.00,
2=1.00,
3=0.25,
4=0.10,
5=0.05;
//double *payment=&money;
void Menu(char *selection); // Displays the list of snack items and prompts for the users choice
{
printf("Please enter a selection :\n");
printf("P Potato Chips $1.25\n");
printf("S - Snickers Bar $1.35\n");
printf("T Pop Tart $0.95\n");
printf("C Cookies $1.50\n");
printf("B Brownie $1.75\n");
printf("N Nuts $1.40\n");
printf("Please enter your snack selection:\n");
scanf(" %c", &item_cost);
}
// void CoinMenu(double *payment); //displays menu of coins and gets user input of the coins deposited
{
printf("Please deposit your money by selection:\n");
printf("1 - $5.00\n");
printf("2 - $1.00\n");
printf("3 - $0.25\n");
printf("4 - $0.10\n");
printf("5 - $0.05\n");
printf("Deposit amount:\n");
scanf("%lf", &money);
}
int CheckMoney(double *payment, double item_cost); //compares the amount the user has deposited to the price of item selected.
//It returns 1 if the amount is at least enough to cover
//the cost, 0 if there is not enough.
if(money<item_cost)
return 0;
else if(money>=item_cost)
return 1;
printf("Welcome to Vend-O-Matic\n");
return 0;