Hi,i am new to c programming.. below show that my final project of my coding..coding is fine,but i want repeat my program from main function after first time attempt is finish without any error..i know that want to add looping to repeat program...but i don't know the concept..please help me to solve this problem..thanks..please..
/*Coding of Our Project*/
#include<stdio.h>
#include<conio.h>
main()
{
int languages,teater,movie,showtime;
int seats,seats2,jumlah,total2;
float total;
do
{
printf("\n>Choose Languages/Pilih Bahasa<\n");
if (languages==1)
{
printf("\nAnda telah memilih Bahasa Melayu");
printf("\nOleh itu,Sila tekan mana-mana kekunci untuk teruskan..");
getch();
}
else
{
printf("\nYou have choosen English languages");
printf("\nSo,Press any key to continue..");
getch();
}
if(languages==1)
switch(teater)
{
case (1):
printf("\nAnda telah memilih GSC(Golden Screen Cinemas)\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
case (2):
printf("\nAnda telah memilih MBO(Malaysian Box Office)\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
case (3):
printf("\nAnda telah memilih Lotus Five Star\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
}
else
switch(teater)
{
case (1):
printf("\nYou have choosen GSC(Golden Screen Cinemas)\n");
printf("Press any key to continue..");
getch();
break;
case (2):
printf("\nYou have choosen MBO(Malaysian Box Office)\n");
printf("Press any key to continue..");
getch();
break;
case (3):
printf("\nYou have choosen Lotus Five Star\n");
printf("Press any key to continue..");
getch();
break;
if(languages==1)
switch(movie)
{
case (1): printf("\nAnda telah memilih filem Robocop\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
case (2): printf("\nAnda telah memilih filem Endless Love\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
case (3): printf("\nAnda telah memilih filem I,Frankstein\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
}
else
switch (movie)
{
case (1): printf("\nYou have choosen Robocop\n");
printf("Press any key to continue..");
getch();
break;
case (2): printf("\nYou have choosen Endless Love\n");
printf("Press any key to continue..");
getch();
break;
case (3): printf("\nYou have choosen I,Frankstein\n");
printf("Press any key to continue..");
getch();
break;
if (languages==1)
switch(showtime)
{
case(1): printf("\nAnda telah memilih tayangan masa anda pada pukul 12.00 PM\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
case(2): printf("\nAnda telah memilih tayangan masa anda pada pukul 6.00 PM\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
case(3): printf("\nAnda telah memilih tayangan masa anda pada pukul 10.00 PM\n");
printf("Sila tekan mana-mana kekunci untuk teruskan..");
getch();
break;
}
else
switch(showtime)
{
case(1): printf("\nYou have choosen 12.00 PM as your movie showtime\n");
printf("Press any key to continue..");
getch();
break;
case(2): printf("\nYou have choosen 6.00 PM as your movie showtime\n");
printf("Press any key to continue..");
getch();
break;
case(3): printf("\nYou have choosen 10.00 PM as your movie showtime\n");
printf("Press any key to continue..");
getch();
break;
}
if(languages==1)
{
printf("\n\n>Bilangan tempat duduk<\n");
printf("Dewasa : ");
scanf("%d",&seats);
printf("Kanak-kanak : ");
scanf("%d",&seats2);
jumlah=seats+seats2;
printf("Oleh itu,jumlah bilangan tempat duduk : %d Orang",jumlah);
printf("\nSila tekan mana-mana kekunci untuk teruskan..");
getch();
}
else
{
printf("\n\n>Number of booking seats<\n");
printf("Adult : ");
scanf("%d",&seats);
printf("Child : ");
scanf("%d",&seats2);
total2=seats+seats2;
printf("So,total number of booking seats : %d Person",total2);
printf("\nPress any key to continue..");
getch();
}
if (languages==1)
{
printf("\n\n>Harga<\n");
printf("\nDewasa = RM10.00");
printf("\nKanak-kanak = RM6.00");
printf("\nCukai Kerajaan = RM0.50");
total=(seats*10.00)+(seats2*6.00)+0.50;
printf("\nOleh itu,harga jumlah yang perlu dibayar ialah RM %.2f",total);
printf("\nSila tekan mana-mana kekunci untuk teruskan untuk melihat resit anda");
getch();
}
else
{
printf("\n\n>Payment<\n");
printf("\nAdult = RM10.00");
printf("\nChild = RM6.00");
printf("\nGoverment Tax = RM0.50");
total=(seats*10.00)+(seats2*6.00)+0.50;
printf("\nSo,the total amount that you have to pay is RM %.2f",total);
printf("\nPress any key to continue to booking for another");
getch();