Sabtu, 10 November 2012

Soalan C - MEAT



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

float price_beef(void);
float price_chic_meat(float b, float priceb);
void price_desplay ( void);
void Exit(void);
void credits(void);

void main()
{
int meat;
printf("\nWelcome To Aminah Online Market ");
printf("\n\n Do you want to buy meat?? \n or to see price of meat?? \n or getout!!?? ");

printf("\n\nMenu ");
printf("\n1 => Chicken ");
printf("\n2 => Beef ");
printf("\n3 => Price meat ");
printf("\n4 => Credits");
printf("\n5 => Exit ");

printf("\nPlease choose: ");
scanf("%d", &meat);
printf("\nPlease enter to continue!!");

if(meat==1)
{
getch();
system("cls");
price_chic_meat( 1, 1);


}

else if(meat==2)
{
getch();
system("cls");
price_beef();

}

else if(meat==3)
{
getch();
system("cls");
price_desplay();

}

else if(meat==5)
{
getch();
printf("\n\n");


}
else if(meat==4)
{
getch();
system("cls");
credits();

}

else
{
printf("\nOut of choice");
printf("\nPlease enter to return");
getch();
system("cls");
main();
}

}

float price_beef(void)
{
float a, pricea;
printf("\nPlease insert no of kilograms of beef that you want buy: ");
scanf("%f", &a);
pricea = a * 9.2;

printf("The price of %.2f kilogram of beef is Rm %.2f ", a, pricea);

getch();
system("cls");
main();


}

float price_chic_meat(float b, float priceb)
{

printf("\nPlease insert no of kilograms of chicken that you want buy: ");
scanf("%f", &b);
priceb = b * 6.5;

printf("The price of %.2f kilogram of chicken is Rm %.2f ", b, priceb);

getch();
system("cls");
main();


}

void price_desplay(void)
{
printf("\nChicken = Rm 6.50 per kilo");
printf("\nBeef = Rm 9.20 per kilo");
getch();
system("cls");
main();

}

void credits(void)
{
printf("\nSiti Aminah Binti Mustaffa");
printf("\n51116212268");
getch();
system("cls");
main();


}

Tiada ulasan:

Catat Ulasan