1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
#include <stdio.h>
#include<math.h>
#define price1 150.00
int main()
{
FILE*fpt;
int c,product,n,discount,total;
float a,b,i,j;
char DOB[15],ans,mail[30],name[20],code,telephone[15],date[15],datea[15],date2[15],days[15],showtime,namea[15];
char DOBa[15],DOBb[15],DOBc[15],datea2[15];
int a1=0,a2=0,a3=0,a4=0,a5=0,b1=0,b2=0;
float cost;
if((fpt=fopen("sample.txt","w"))==NULL)
{
printf ("this file can't find");
}
else
while((code=getchar())!=EOF)
{
switch(code)
{
case 'a':
case 'A':
printf("Proposed Date of Booking :");
scanf("%s %s",date,datea);
printf("\tAVAILABLE SHOWTIMES\n\n");
printf("\ta RAMKHAMHANG 19:00hrs %s %s\n",date,datea);
printf("\tb SUKSAWAD 13:00hrs %s %s\n",date,datea);
printf("\tc CHANGWATANA 09:00hrs %s %s\n",date,datea);
printf("Choose desired showtime :");
scanf(" %c",&showtime);
if(showtime=='a'||showtime=='A')
{
if(a1>12||a2>12)
{
printf("TICKET FULLY BOOKED\n");
break;
}
printf("Do you want to pay now Y/N :");
scanf(" %c",&ans);
if(ans=='y'||ans=='Y')
{
printf("Please enter customer details below\n\n");
printf("Name Surname :");
scanf("%s %s",name,namea);
printf("D.O.B(enter the date month and year in full) :");
scanf("%s %s %s",DOBa,DOBb,DOBc);
printf("E-mail Address :");
scanf(" %s",mail);
printf("Telephone Number :");
scanf(" %s",telephone);
printf("proposed Date of return :");
scanf(" %s %s",date2,datea2);
printf("\n\n\n\n\n\n\n");
}
}
else
{
printf("\nTotal : %d baht\n",product);
fprintf(fpt,"Total : %d baht\n",product);
}
printf("\nThank you for booking for the movie!!\n");
fprintf(fpt,"\nThank you for booking for the movie!!\n");
return 0;
}
}
|