Jump to content
Sign in to follow this  
buscows

Bro Sekalian Tolong Ak Dengan C Ni...

Recommended Posts

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void movielist (void); //function prototype
void moviechoose (void);
void print (int b []);
float discount (float c);

char item1[] = "OMBAK RINDU....RM 6.00"; //global declaration of array of items
char item2[] = "SONGLAP....RM 6.00";
char item3[] = "DON 2....RM 6.00";
char item4[] = "RA 1....RM 8.00";
char item5[] = "REAL STEEL....RM 8.00";
char item6[] = "SCORPION KING 3....RM 8.00";
char item7[] = "DARK KNIGHT-RETURN OF DARK KNIGHT....RM 10.00";
char item8[] = "IP MAN 3....RM 10.00";
char item9[] = "IRON MAN 3....RM 10.00";
char item10[] = "TRAnSFORMER 4....RM 11.00";

float p[10] = {6.00,6.00,6.00,8.00,8.00, 8.00, 10.00, 10.00, 10.00, 11.00}; //price of items
float total = 0;

int Student, choose, add;
int counter = 0;

int a[10] = {0};

int main ()

{

int d,e,f,g,h,j;
printf("\n\t\t\t\t--WELCOME TO--");
printf("\n\t\t<<<< HHAA MOVIE CINEMA ONLINE BOOKING TICKET>>>> \n");

printf("\n\n\t\t\t\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
printf("\n\t\t\t\t%%%%%% Main Menu %%%%%%%\n");
printf("\t\t\t\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");

printf("a...<11.00 a.m - 1.00 p.m>...\n\n");
printf("b...<1.00 p.m - 3.00 p.m>...\n\n");
printf("c...<4.00 p.m - 6.00 p.m>...\n\n");
printf("d...<6.00 p.m - 8.00 p.m>...\n\n");
printf("e...<9.00 p.m - 10.00 p.m>...\n\n");
printf("f...<10.00 p.m - 12.00 p.m>...\n\n");

char time;
printf("Choose only Time given above: ");
scanf("%c",&time);

switch(time){
case 'a':
printf("\n You have choose 11.00 a.m - 1.00 p.m \n");
break;

case 'b':
printf("\n You have choose 1.00 p.m - 3.00 p.m\n");
break;

case 'c':
printf("\n You have choose 4.00 p.m - 6.00 p.m\n");
break;

case 'd':
printf("\n You have choose 6.00 p.m - 8.00 p.m\n");
break;

case 'e':
printf("\n You have choose 9.00 p.m - 10.00 p.m\n");
break;

case 'f':
printf("\n You have choose 10.00 p.m - 12.00 p.m\n\n");
break;

default:
printf("\n..error...please reboot the program..please choose only the time given..\n\n");
break;
}


printf ("Student or non-Student?\n");
printf ("1)yes\n2)no\n");
printf ("\nanswer:");
scanf ("%d", &Student);

switch (Student){
case 1:
while (counter <= 1){
movielist ();
moviechoose();
printf ("\nDo you want to..:\n");
printf ("1)add movie\n2)done\n3)reset and add movie\n");
printf ("\nchoose: \n");
scanf ("%d", &add);
switch (add){
case 1:
continue;
case 2:
counter +=2;
break;
case 3:
total = 0;
a[0] = 0; a[1] = 0;a[2] = 0;a[3] = 0;a[4] = 0;a[5] = 0;a[6] = 0;a[7] = 0;a[8] = 0;a[9] = 0;
break;

}

}
case 2:
while (counter <= 1){
movielist (); //function call itemlist
moviechoose (); //function call itemchoose
printf ("\nDo you want to..:\n");
printf ("1)add movie\n2)done\n3)reset and add movie\n");
printf ("\nchoose:");
scanf ("%d", &add);
switch (add){
case 1:
continue;
case 2:
counter +=2;
break;
case 3:
total = 0;
a[0] = 0; a[1] = 0;a[2] = 0;a[3] = 0;a[4] = 0;a[5] = 0;a[6] = 0;a[7] = 0;a[8] = 0;a[9] = 0;
continue;
printf ("\n");
return 0;
}

}
}

printf("\n");
print (a);
printf("total price = RM%.2f\n\n",total);

if (Student == 1){
printf("*****discount 20%% for Student*****");
printf("\ntotal price after discount = RM%.2f\n\n",discount(total));
}

printf("Please Enter your MyKad number..Exp...920820136133...:");
scanf("%6d%2d%4d",&d,&e,&f);
printf("Your MyKad number entered is: %.6d-%.2d-%.4d\n\n",d,e,f);
printf("Loading..Please wait\n\n");
Sleep(4000);

printf("..We have booked your ticket..\n\n");
printf("..Please proceed to our counter ticket at HHAA MOVIE CINEMA for the payment and to register your seat..\n\n");
printf("..Show your MyKad for our notification of your purchase ticket..\n\n");
printf("..Thank you for using our online booking ticket..\n\n");

printf("..For further information please contact our office number=088-8888..");
return 0;

}

void movielist(void)

{
printf ("\nHere is our ticket movie on sale:\n");
printf("1)%s\n2)%s\n3)%s\n",item1,item2,item3);
printf("4)%s\n5)%s\n6)%s\n",item4,item5,item6);
printf("7)%s\n8)%s\n9)%s\n10)%s\n",item7,item8,item9,item10);

}

void moviechoose(void)
{
printf("\nChoose item:");
scanf ("%d", &choose);
switch(choose){
case 1:
total += p[0];
a[0]++;
break;
case 2:
total += p[1];
a[1]++;
break;
case 3:
total += p[2];
a[2]++;
break;
case 4:
total += p[3];
a[3]++;
break;
case 5:
total += p[4];
a[4]++;
break;
case 6:
total += p[5];
a[5]++;
break;
case 7:
total += p[6];
a[6]++;
break;
case 8:
total += p[7];
a[7]++;
break;
case 9:
total += p[8];
a[8]++;
break;
case 10:
total += p[9];
a[9]++;
break;
default:
printf("the number your enter is not on the movie list\n");
printf("please choose another number\n");
break;
}

}

void print (int b[])

{
if (b[0]){
printf(" %s x %d = RM%.2f\n",item1,b[0], (p[0]*b[0]));
}
if (b[1]){
printf(" %s x %d = RM%.2f\n",item2,b[1], (p[1]*b[1]));
}
if (b[2]){
printf(" %s x %d = RM%.2f\n",item3,b[2], (p[2]*b[2]));
}
if (b[3]){
printf(" %s x %d = RM%.2f\n",item4,b[3], (p[3]*b[3]));
}
if (b[4]){
printf(" %s x %d = RM%.2f\n",item5,b[4], (p[4]*b[4]));
}
if (b[5]){
printf(" %s x %d = RM%.2f\n",item6,b[5], (p[5]*b[5]));
}
if (b[6]){
printf(" %s x %d = RM%.2f\n",item7,b[6], (p[6]*b[6]));
}
if (b[7]){
printf(" %s x %d = RM%.2f\n",item8,b[7], (p[7]*b[7]));
}
if (b[8]){
printf(" %s x %d = RM%.2f\n",item9,b[8], (p[8]*b[8]));
}
if (b[9]){
printf(" %s x %d = RM%.2f\n",item10,b[9], (p[9]*b[9]));
}
}

float discount (float c)
{
return (c -(c * 0.2));//discount
}





program da siap cuma nk add skit bg menarik..ak cuma xtau nk wat repeatation...contoh bila boh salah pilihan dia akan ulang ke tempat asal untuk buat pilihan lagi sekali...sapa2 ada link report program bole2 kongsi dak? he3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...