Hi
I am a student at Westminster Kingsway college and i am studying c programming for my course, i need some help for a coffee dispenser that i created for one of my assessments.
Every Time I Ask For Change It Does Not Stop Looping
Code:
#include<process.h>
#include"header.h"
#include<stdio.h>
#include<conio.h>
void main(void)//Emre
{
int mainoption;
system("color 9f");
do{
mainoption = SnacksMainMenu();//Sheku
SnacksMenuChoice(mainoption);//Riffat
ClearTheScreen();
}while(mainoption != 2768);
getch();
}
unsigned int SnacksMainMenu(void)//SnacksMainMenu
{
int option;
printf("The Rapid Snacks Coffee Dispenser - *** By Emre Celikoz *** \n");
printf("\n1. Coffee With Milk : 50p\n");
printf("2. Coffee Without Milk : 50p\n");
printf("3. Coffee with Sugar : 50p\n");
printf("4. Coffee Without Sugar : 50p\n");
printf("5. Tea With Milk : 50p\n");
printf("6. Tea Without Milk : 50p\n");
printf("7. Tea With Sugar : 50p\n");
printf("8. Tea With Sugar : 50p\n");
printf("9. Chicken And Vegetable Soup : 75p\n");
printf("10. Mulligatawny Soup : 75p\n");
printf("11. Tomato Soup : 75p\n");
printf("12. Hot Chocolate : 35p\n");
printf("13. Hot Water : 10p\n");
printf("\n");
printf("Please Enter Your Selection Number > ");
scanf("%d",&option);
return option;
}
void SnacksMenuChoice(unsigned int choice)//SnacksMenuChoice
{
if(choice == 1)//Coffee With Milk
{
int AmountOwing = 50;
int Contribution;
int AmountOfDebt;
int Change;
AmountOfDebt = AmountOwing;
printf("\nYou Have Selected Coffee With Milk...\n");
printf("\nPlease Enter %d > ",AmountOwing);
scanf("%d",&Contribution);
if(Contribution <= 49){
do{
printf("\nEnter amount >");
scanf("%d",&Contribution);
AmountOfDebt = AmountOfDebt - Contribution;
}while(AmountOfDebt != 0);
}
else if(Contribution == 50)
{
printf("Thank You For Your Using Rapid Snacks\n");
printf("Please Collect Your Item From Below\n");
}
else if(Contribution >= 51){
printf("Thank You For Your Using Rapid Snacks\n");
Change = Contribution - 50;
printf("Please Collect Your Change %d\n",Change);
printf("Please Collect Your Item From Below\n");
}
getch();
}
Thank You, Hackstorix