#include <iostream>
using namespace std;
int main ()
{
int movie1;
int movie2;
int movie3;
int seats;
int price;
int select;
char response;
cout<<"______Wellcome to Strawberry Gold Cinema____\n"
<<"Now you are booking a ticket cinema and please choose your movie... ";
cout << "\nPress 1 for= Harry Potter \n"
<< "Press 2 for = Iron Man\n"
<<"Press 3 for = Romeo and Juliet\n";
cout<<"Enter your choice > ";
cin>>select;
if (select ==1 )
{
cout<<"The price of the ticket per seat is RM10.00\n"
<<"Please enter the number of seat ";
cin>>seats;
if (seats<=30)
{
price = 10 * seats;
cout<<"The total price is RM"<<price<<endl;
}
else if (seats>=30)
{
cout<<"The movie is full.\n"
<<"Would like to choose another movie??\n"
<<"Section Y or N \n";
cout<<"Enter your choice = ";
cin>>response;
}
if ( toupper( response ) == 'Y' )
{
cout <<"Please choose movie 2 or movie 3\n"
<<"Enter your choice ";
cin>>select;
if (select == 2)
{
cout<<"The price of the ticket per seat is RM11.00\n"
<<"Please enter the number of seat";
cin>>seats;
if (seats<=30)
{
price = 11 * seats;
cout<<"The total price is RM"<<price<<endl;
}
}
else if (seats>=30)
{
cout<<"The movie is full.\n"
<<"Would like to choose another movie??\n"
<<"Section Y or N \n";
cout<<"Enter your choice = ";
cin>>response;
}
if ( toupper( response ) == 'Y' )
{
cout<<"The price of the ticket per seat is RM13.00\n"
<<"Please enter the number of seat";
cin>>seats;
if (seats<=30)
{
price = 13 * seats;
cout<<"The total price is RM"<<price<<endl;
}
else if (seats>=30)
{
cout<<"The movie is full.\n"
<<"Next movie in 5 hours...."<<endl;
}
else
cout << "Next movie in 5 hours.\n";
}
}
}
//for 2
if (select ==2 )
{
cout<<"The price of the ticket per seat is RM11.00\n"
<<"Please enter the number of seat";
cin>>seats;
if (seats<=30)
{
price = 11 * seats;
cout<<"The total price is RM"<<price<<endl;
}
else if (seats>=30)
{
cout<<"The movie is full.\n"
<<"Would like to choose another movie??\n"
<<"Section Y or N \n";
cout<<"Enter your choice = ";
cin>>response;
}
if ( toupper( response ) == 'Y' )
{
cout <<"Please choose movie 1 or movie 3\n"
<<"Enter your choice ";
cin>>select;
if (select == 2)
{
cout<<"The price of the ticket per seat is RM10.00"
<<"Please enter the number of seat";
cin>>seats;
if (seats<=30)
{
price = 10 * seats;
cout<<"The total price is RM"<<price<<endl;
}
}
else if (seats>=30)
{
cout<<"The movie is full.\n"
<<"Would like to choose another movie??\n"
<<"Section Y or N \n";
cout<<"Enter your choice = ";
cin>>response;
}
if ( toupper( response ) == 'Y' )
{
cout<<"The price of the ticket per seat is RM13.00\n"
<<"Please enter the number of seat";
cin>>seats;
if (seats<=30)
{
price = 13 * seats;
cout<<"The total price is RM"<<price<<endl;
}
else if (seats>=30)
{
cout<<"The movie is full.\n"
<<"Next movie in 5 hours...."<<endl;
}
else
cout << "Next movie in 5 hours.\n";
}
}
}
}
Date :
2011-09-28 07:29:09
By :
นกแสก
No. 17
Guest
โค้ดจองตั๋วหนัง ภาษาซี
#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' :
clrscr();
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);
clrscr();
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')
{
clrscr();
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;
}
#include<stdio.h>
#include<conio.h>
int main(){
int r,i,j,k;
printf("Enter the number range: ");
scanf("%d",&r);
for(i=1;i<=r;i++){
for(j=1;j<=12;j++)
printf("\n\n%d*%d=%d ",i,j,i*j);
printf("\n");
}
getch();
}
int main()
{ unsigned long amount=1000,deposit,withdraw;
int choice,pin=0,k=0;
char another='y';
while(pin!=0000)
{
printf("Enter your four digit pin:");
scanf("%d",&pin);
}
do
{
printf("\n********Welcome to ATM Service**************\n");
printf("1. Check Balance\n");
printf("2. Withdraw Cash\n");
printf("3. Deposit Cash\n");
printf("4. Quit\n");
printf("******************?**************************?*\n\n");
printf("Enter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nYour Balance is Rs : %lu ",amount);
break;
case 2:
printf("\nEnter the amount to withdraw: ");
scanf("%lu",&withdraw);
if(withdraw%100!=0)
{
printf("\nPlease enter");
printf("amount in multiples of 100");
}else if(withdraw>(amount-500))
{
printf("\nInsufficient Funds");
}else
{
amount=amount-withdraw;
printf("\n\nPlease collect cash");
printf("\nYour balance is %lu",amount);
}
break;
case 3:
printf("\nEnter amount to deposit:-");
scanf("%lu",&deposit);
amount=amount+deposit;
printf("Your balance is:- %lu",amount);
break;
case 4:
printf("\nThank you for using ATM");
break;
default:
printf("\nInvalid Choice");
}
printf("\n\n\nDo you want another transaction?(y/n): ");
fflush(stdin);
scanf("%c",&another);
if(another=='n'||another=='N')
k=1;
}while(!k);
printf("\n\nHave a nice day");
getch();