How to make Movie Booking App in C Language in Hindi

C Language में Movie Booking App कैसे बनाए ?

Movie Booking Code Image


यहां पर मैं कोई Graphical User Interface इस्तमाल नहीं करूंगा। मैं सबकुछ Text से show करने की कोशिश करूंगा। आप तुरंत चाहे तो Code File को download कर सकते है।

Code File: Google Drive Link


Movie Booking App के Features।

इसमें मैने कुछ Movies दी है Starting में आप उनमें से कोई भी Movie, Number Type करके चुन सकते है।यह प्रोग्राम Movie के बारे में जानकारी देता है और उसकी Price बताता है। 

फिर Rows पूछी जाति है को कौनसी row बैठना चाहेंगे।

उसके बाद Time पूछा जाता है किस Time पर आप book करना चाहेंगे। यह सब Numbers को मदद से पूछूंगा।


Movie Booking App को कैसे लिखे ?

आप चाहे तो सब कुछ एक साथ लिख सकते है। लेकिन इसमें बहुत Repitition होगा। मतलब एक ही Code बार बार लिखना होगा। इससे बचने के लिए हम कुछ Functions बनाकर लिखेंगे।

जो चीज हम बार लिखने जा रहे है उसे एक Function बना देंगे। फिर हमे सिर्फ function का नाम लिखना होगा।


नीचे मैने इसका Code दिया है।

Code Starts 

#include <studio.h>



int time(int t, char mo[])

{

    int perm;

    printf("Timing %d:00\n", t);

    printf("Enter 1 for Payment or Enter 2 to Cancel\n");

    scanf("%d", &perm);

    printf("****************************************************\n");

    if (perm == 1)

    {

        printf("Payment Succesful !\n");

        printf("Thanks For Booking\n");

        printf("       ---------------------\n");

        printf("Ticket |Movie: %s          |\n", mo);

        printf("Ticket |Price: 25$         |\n");

        printf("Ticket |Timing:%d:00       |\n", t);

        printf("Ticket |Place:Theater      |\n");

        printf("       ---------------------\n");

        printf("*********************************************************\n");

    }

}



void m1()

{

    printf("Description: An ancient Kahndaq, Teth Adam was bestowed the almighty powers of the gods. After using these powers for vengeance, he was imprisoned, becoming Black Adam. Nearly 5,000 years have passed, and Black Adam has gone from man to myth to legend.\n");

}



void m2()

{

    printf("Description: Spider-Man seeks the help of Doctor Strange to forget his exposed secret identity as Peter Parker. However, Strange's spell goes horribly wrong, leading to unwanted guests entering their universe.\n");

}

void m3()

{

    printf("Description: Queen Ramonda, Shuri, M'Baku, Okoye and the Dora Milaje fight to protect their nation from intervening world powers in the wake of King T'Challa's death. As the Wakandans strive to embrace their next chapter, the heroes must band together with Nakia and Everett Ross to forge a new path for their beloved kingdom.\n");

}

void m4()

{

    printf("Description: Jake Sully and Ney'tiri have formed a family and are doing everything to stay together. However, they must leave their home and explore the regions of Pandora. When an ancient threat resurfaces, Jake must fight a difficult war against the humans.\n");

}



char Descr(char m[], int num)

{

    int timing;

    int t1 = 9, t2 = 11, t3 = 14, t4 = 17;

    int row, perm;



    printf("Movie name: %s\n", m);

    if (num == 1)

    {

        m1();

    }

    else if (num == 2)

    {

        m2();

    }

    else if (num == 3)

    {

        m3();

    }

    else if (num == 4)

    {

        m4();

    }

    printf("Price: 25$\n");

    printf("---------------------------------------------------\n");

    //For Rows

    printf("1. Front Row\n");

    printf("2. Back Row\n");

    printf("3. Side Row\n");

    printf("4. Middle Row\n");

    printf("Enter number for seat:  ");

    scanf("%d", &row);

    printf("---------------------------------------------------\n");

    printf("[1] %d:00\n", t1);

    printf("[2] %d:00\n", t2);

    printf("[3] %d:00\n", t3);

    printf("[4] %d:00\n", t4);

    printf("Enter number for timing:  ");

    scanf("%d", &timing);

    printf("----------------------------------------------------\n");

    if (timing == 1)

    {

        time(t1, m);

    }

    else if (timing == 2)

    {

        time(t2, m);

    }

    else if (timing == 3)

    {

        time(t3, m);

    }

    else if (timing == 4)

    {

        time(t4, m);

    }

}



int main()

{

    int movienum, repeat = 1, timing;

    int perm;

    char a[] = "Black Adam", b[] = "SpiderMan No Way Home", c[] = "Black Panther: Wakanda Forever", d[] = "Avatar: The Way Of Water";



    do

    {

        printf("-----------------Welcome To Booking Of Movies------------------\n");

        printf("1.%s\n", a);

        printf("2.%s\n", b);

        printf("3.%s\n", c);

        printf("4.%s\n", d);

        printf("Enter the number for movie:  ");

        scanf("%d", &movienum);

        printf("----------------------------------------------------------------\n");

        if (movienum == 1)

        {

            Descr(a, movienum);

        }

        else if (movienum == 2)

        {

            Descr(b, movienum);

        }

        else if (movienum == 3)

        {

            Descr(c, movienum);

        }

        else if (movienum == 4)

        {

            Descr(d, movienum);

        }



    } while (repeat == 1);



    return 0;

}

Code Ends


इस Post को पढ़ने के लिए धन्यवाद :)

टिप्पणियाँ

लोकप्रिय पोस्ट