 |
|
โค้ดโปรแกรมจองตั๋วหนัง ภาษา C
Code (C)
#include <stdio.h>
#include <string.h>
#include <conio.h>
main()
{
char s,ro;
int re;
char a,b,c,d,e;
printf("---------------M A J O R C I N E P L E X------------------\n\n");
printf("MENU\n");
printf("1. Select Seats\n");
printf("2. Exit\n");
printf("\n\nPlease Select Menu : ");
scanf("%s",&s);
switch(s)
{
case '1' :
printf("---------------M A J O R C I N E P L E X------------------\n\n");
printf("#############################################################\n\n");
printf("=====================S==C==R==E==E==N========================\n\n");
printf("#############################################################\n\n");
for(a=1;a<11;a++)
{
printf(" [A%d] ",a);
}
printf("\n");
for(b=1;b<11;b++)
{
printf(" [B%d] ",b);
}
printf("\n");
for(c=1;c<11;c++)
{
printf(" [C%d] ",c);
}
printf("\n");
for(d=1;d<11;d++)
{
printf(" [D%d] ",d);
}
printf("\n");
for(e=1;e<11;e++)
{
printf(" [E%d] ",e);
}
printf("\n\n");
printf("#############################################################\n\n");
printf("Select Seats\n");
printf("select Row : ");
scanf("%s",&ro);
printf("Respectively : ");
scanf("%d",&re);
printf("---------------M A J O R C I N E P L E X------------------\n\n");
printf("#############################################################\n\n");
printf("=====================S==C==R==E==E==N========================\n\n");
printf("#############################################################\n\n");
if(ro=='a')
{
for(a=1;a<11;a++)
{
if(a==re)
{
printf(" [XX] ");
}
else printf(" [A%d] ",a);
}
printf("\n");
for(b=1;b<11;b++)
{
printf(" [B%d] ",b);
}
printf("\n");
for(c=1;c<11;c++)
{
printf(" [C%d] ",c);
}
printf("\n");
for(d=1;d<11;d++)
{
printf(" [D%d] ",d);
}
printf("\n");
for(e=1;e<11;e++)
{
printf(" [E%d] ",e);
}
printf("\n\n");
printf("#############################################################\n\n");
}
if(ro=='b')
{
for(a=1;a<11;a++)
{
printf(" [A%d] ",a);
}
printf("\n");
for(b=1;b<11;b++)
{
if(b==re)
{
printf(" [XX] ");
}
else printf(" [B%d] ",b);
}
printf("\n");
for(c=1;c<11;c++)
{
printf(" [C%d] ",c);
}
printf("\n");
for(d=1;d<11;d++)
{
printf(" [D%d] ",d);
}
printf("\n");
for(e=1;e<11;e++)
{
printf(" [E%d] ",e);
}
printf("\n\n");
printf("#############################################################\n\n");
}
if(ro=='c')
{
for(a=1;a<11;a++)
{
printf(" [A%d] ",a);
}
printf("\n");
for(b=1;b<11;b++)
{
printf(" [B%d] ",b);
}
printf("\n");
for(c=1;c<11;c++)
{
if(c==re)
{
printf(" [XX] ");
}
else printf(" [C%d] ",c);
}
printf("\n");
for(d=1;d<11;d++)
{
printf(" [D%d] ",d);
}
printf("\n");
for(e=1;e<11;e++)
{
printf(" [E%d] ",e);
}
printf("\n\n");
printf("#############################################################\n\n");
}
if(ro=='d')
{
for(a=1;a<11;a++)
{
printf(" [A%d] ",a);
}
printf("\n");
for(b=1;b<11;b++)
{
printf(" [B%d] ",b);
}
printf("\n");
for(c=1;c<11;c++)
{
printf(" [C%d] ",c);
}
printf("\n");
for(d=1;d<11;d++)
{
if(d==re)
{
printf(" [XX] ");
}
else printf(" [D%d] ",d);
}
printf("\n");
for(e=1;e<11;e++)
{
printf(" [E%d] ",e);
}
printf("\n\n");
printf("#############################################################\n\n");
}
if(ro=='e')
{
for(a=1;a<11;a++)
{
printf(" [A%d] ",a);
}
printf("\n");
for(b=1;b<11;b++)
{
printf(" [B%d] ",b);
}
printf("\n");
for(c=1;c<11;c++)
{
printf(" [C%d] ",c);
}
printf("\n");
for(d=1;d<11;d++)
{
printf(" [D%d] ",d);
}
printf("\n");
for(e=1;e<11;e++)
{
if(e==re)
{
printf(" [XX] ");
}
else printf(" [E%d] ",e);
}
printf("\n");
printf("\n\n");
printf("#############################################################\n\n");
}
if (ro!='a')
{
if (ro!='b')
{
if (ro!='c')
{
if (ro!='d')
{
if (ro!='e')
{
printf("Sorry, You enter the wrong.\n");
}
}
}
}
}
printf("\nThank you for the service.\n");
getch();
break;
case '2' :
printf("\nThank you for the service.\n");
getch();
break;
}
return 0;
}

|
 |
 |
 |
 |
Date :
2012-08-29 14:26:21 |
By :
นกแสก |
|
 |
 |
 |
 |
|
|
 |