CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2015
    Posts
    2

    Unhappy Help! for movie tickets [I'm seriously dying]

    so I'm just a beginner and my teacher gave me complicated final project. I really need help as I have to submit it next week. please help.
    1. display greeting (i've done it)
    2. display seats (already)
    3. price of tickets (already)
    4. ask user seats (I'm stuck from here)
    5. tell if available or unavailable. if yes, tell ticket price. if not, display seats ask to find other seat.
    6. if decided to buy, ask for name and display payment receipt.
    7. calculate n display in file tickets sold by rows in number and RM and then display total sales.
    8. seats should be updated.
    9. display bar chart of ticket sold vs no of rows.
    it's toooo long that I really need help. btw, I'm malaysian and dikir barat is a show name and RM is our currency.

    here's my coding, I've already try other's program but it couldn't work

    #include <iostream>
    #include <iomanip>
    #include <istream>
    using namespace std;
    void place(char seats[15][30]);
    int main ()
    {
    char seats[15][30]={{'*','*','*','*','*','#','#','*','*','*','*','*','*','*','#','*','*','*','*','*','#','#','#','#','#','#','*','*','*','#'},{'*','*','#','#','*','*','*','#','#','#','*','*','#','*','*','*','*','*','#','#','*','*','#','#','*','*','*','#','*','*'},{'#','#','*','#','*','#','#','*','*','#','#','*','*','*','#','#','*','*','*','*','#','#','#','#','#','#','#','#','*','#'},{'*','*','#','*','*','#','#','*','*','#','*','*','*','*','#','*','#','*','*','*','#','#','#','#','#','#','*','*','#','#'},{'#','#','#','#','*','*','*','#','#','#','*','*','#','*','#','*','*','*','#','#','*','*','#','#','*','*','*','#','*','*'},{'#','*','*','*','*','#','#','*','*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','*','*'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','#','*','*','*','*','*','#','*','#','*','#','#','*','*','*','*'},{'*','*','*','*','*','*','*','*','*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','*','*'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','#','#','*','*','#','#','*','*','*','#'},{'*','*','*','#','*','*','*','#','*','#','*','*','#','*','*','*','*','*','#','#','*','*','#','#','*','*','*','#','*','*'},{'*','*','*','*','*','#','*','*','*','*','*','*','*','*','*','*','*','*','*','*','#','*','*','*','*','#','*','*','*','*'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','#','*','*','*','*','*','*','#','#','#','*','*','*','*','*','#'},{'*','*','*','*','*','#','#','*','*','*','*','*','*','*','*','*','*','*','*','*','#','#','*','*','*','*','*','*','*','#'},{'*','*','*','*','*','*','#','*','*','*','*','*','*','*','#','*','*','*','*','*','*','*','*','#','#','#','*','*','*','*'},{'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','*','#'}};
    cout<<" The Dikir Barat Show"<<endl;
    cout<<setw(40)<<"Welcome"<<endl;

    place(seats);

    cout<<endl<<"* : AVAILABLE\n"<<"# : BOOKED";
    cout<<endl<<endl<<endl;
    cout<<" TICKET PRICING"<<endl;
    cout<<"________________________________________________________________________"<<endl;
    cout<<"| Row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |"<<endl;
    cout<<"_______|_______|_______|_______|_______|_______|_______|_______|_______|"<<endl;
    cout<<"| RM | 10 | 10 | 10 | 12 | 14 | 16 | 18 | 20 |"<<endl;
    cout<<"_______________|_______|_______|_______|_______|_______|_______|_______|"<<endl;
    cout<<"________________________________________________________________"<<endl;
    cout<<"| Row | 9 | 10 | 11 | 12 | 13 | 14 | 15 |"<<endl;
    cout<<"_______|_______|_______|_______|_______|_______|_______|_______|"<<endl;
    cout<<"| RM | 25 | 30 | 25 | 20 | 18 | 14 | 10 |"<<endl;
    cout<<"_______|_______|_______|_______|_______|_______|_______|_______|"<<endl<<endl;


    return 0;
    }


    void place(char seat[15][30])
    {
    cout<<endl<<setw(40)<<"Seats"<<endl;
    cout<<" | a | b | c |"<<endl;
    cout<<" ";

    for (int i=1;i<10;i++)
    {
    cout<<i<<" ";
    continue;
    }

    for (int i=10;i<20;i++)
    {
    cout<<i-10<<" ";
    continue;
    }
    for (int i=20;i<30;i++)
    {
    cout<<i-20<<" ";
    continue;
    }
    int i;
    if (i=30)
    {
    cout<<i-30<<" ";
    }
    cout<<endl;
    for (int i=0;i<9;i++)
    {
    cout<<"ROW "<<i+1<<" ";
    for (int j=0;j<30;j++)
    {

    cout<<seat[i][j]<<" ";
    }
    cout<<endl;
    continue;
    }
    for (int i=9;i<15;i++)
    {
    cout<<"ROW "<<i+1<<" ";
    for (int j=0;j<30;j++)
    {
    cout<<seat[i][j]<<" ";
    }
    cout<<endl;
    continue;
    }
    }

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Help! for movie tickets [I'm seriously dying]

    First, please, use CODE tags while posting code snippets. See Announcement: Before you post....
    Second, what exactly "couldn't work"?
    Victor Nijegorodov

  3. #3
    Join Date
    May 2015
    Posts
    2

    Re: Help! for movie tickets [I'm seriously dying]

    i tried to use code from other peoples, but it's not fitting to requirements that my teacher needs.

    i'm sorry for not using code tags

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Help! for movie tickets [I'm seriously dying]

    i tried to use code from other peoples,
    That is considered cheating and is not condoned. See http://forums.codeguru.com/showthrea...ork-assignment

    Code:
    int i;
    if (i=30)
    Your first issue is here. You define i as a type int but don't initialise it so its initial value is undefined - and then you set i to 30 (do you mean equality which is == ?) and then you test that the result of assigning 30 to i as a condition is true. The result of assigning 30 to i will always be 30 so the condition is always true.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured