Help with a simple program

Discussion in 'C++' started by Nikidinho, Feb 13, 2009.

  1. Nikidinho

    Nikidinho New Member

    Joined:
    Feb 13, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    It is in the booking system of the railways. I have to create a module that accepts the details of a passenger and checks whether the ticket has been confirmed or is in the waiting list. The module then prints the the list of confirmed passengers. Declare a class "Ticket", which consists of three member functions, "booking ()", "status ()" and "print ()" Thanks for any help!
     
  2. cpulocksmith

    cpulocksmith New Member

    Joined:
    Jul 23, 2008
    Messages:
    289
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    student
    Location:
    canada
    well why dont you try your hand at making it and if you have a problem post the code you have and we can help you out with it ^^.
     
  3. Nikidinho

    Nikidinho New Member

    Joined:
    Feb 13, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Ohk I'll try =P
    Code:
    #include <iostream.h>
    Class Ticket
    public:
    
    void booking ()
    {
    cout<<"Tickets Booked"<<endl;
    }
    void status ()
    {
    cout<<"Reserved"<<endl;
    }
    void print ()
    {
    cout<<"Happy Journey";
    }
    };
    
    Can any of you guys please tell me my mistakes? Thanks =P
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    That's not much of a try...
    Which part are you stuck on? What don't you know how to do?
    Are you hoping we'll write the program for you?
     
  5. Nikidinho

    Nikidinho New Member

    Joined:
    Feb 13, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    No I'm not... I'm learning C++ from a book and this was an exercise which was given at the end of the chapter. The only example they gave was a much more simple program, so this is all I know :(
     
  6. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    It may be a good idea then to shelve this project until you've worked though a lot more of the book.
    Which book is it and what chapter? It seems odd they would give such a complex exercise having only shown you how to write a function header.
     
  7. Nikidinho

    Nikidinho New Member

    Joined:
    Feb 13, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Ohk thanks for your advice :happy:
    It is Programming Using C++ from NIIT and it's chapter two.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice