Which is the best method for this problem??

This is a discussion on Which is the best method for this problem?? within the C Programming forums, part of the General Programming Boards category; GUYS do u have any idea which method is best used in this kind of situation?And how should i write ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    8

    Question Which is the best method for this problem??

    GUYS do u have any idea which method is best used in this kind of situation?And how should i write the code??

    PURCHASING MODULE
    B to purchase ticket for Business class
    E to purchase ticket for Economy class
    M to return to Main Menu

    Assigning Seats
    If the person types B, then your program should assign a seat in the business class (seats 1-5). If the person types E, then your program should assign a seat in the economy class (seats 6 - 25).

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,787
    What methods are you considering?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    8
    hmmm...not sure coz this is the first time i come across this type of question...=X......Wat do u think then???

  4. #4
    Registered User
    Join Date
    Feb 2009
    Posts
    138
    i don't know what you mean by "method". i'd separate the problem into parts and then write and test each part. when all of the parts work, i'd put them together with a driver. that's my method.

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    35
    Quote Originally Posted by kahwei View Post
    GUYS do u have any idea which method is best used in this kind of situation?And how should i write the code??

    PURCHASING MODULE
    B to purchase ticket for Business class
    E to purchase ticket for Economy class
    M to return to Main Menu

    Assigning Seats
    If the person types B, then your program should assign a seat in the business class (seats 1-5). If the person types E, then your program should assign a seat in the economy class (seats 6 - 25).
    Ive started it off:
    Code:
    #include <iostream>
    #include <string>
    
    
    using namespace std;
    
    int main(void)
    {
        
        system("TITLE Ticket Purchasing Module");
        
        string name;
        
       
        
        cout << "Please enter name to print on ticket then press " 
        ;cout << "B to purchase ticket in business" 
        ;cout << "class, E to purchase ticket in economy class "
        ;cout << "or M to return to menu \n" ;
        
        ;cout << "Please enter name: \n"
        ;cin >> name; 
        
        ;system("PAUSE");
        return 0;
    }

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Rockergal: Why do you put the ; at the beginning of the line.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,754
    this is C++

    I wonder what happened in the last several days that we get a lot of incorrect forum postings?

    C on C++
    C++ on C
    Windows or linux specific on C forum etc...

    I do not really get it
    To be or not to be == true

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    In this case, I think it's rockergal that didn't pay attention, and submitted a solution for C++ in a C forum. The original posters previous posts are C.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Feb 2009
    Posts
    8
    yeah....its a C++ solution and i cant understand it...=(...i am just learning about Basic of C....But anyway thx for ur CODE 'ROCKERGAL"....=D..Hope u can translate it to C so i can understand it more...=X.....

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    35
    sorry people I thought there were minor differances in c and c++ I have a template for borland that I can modify it to but I wont be able to test it as I find borland really complex to install and I cant seem to find a decent C one that works
    *edit* Im learning to I have a write a program that a little bit more complicated than yours if anyone can suggest compilers that are as easy to install like dev C++ I can write yours and modify it to mine or vice versa =)
    I tried ......
    the only problem I get it how to tell the program what letter has been inputted and what it should display like in kahweis program
    Last edited by geekrockergal; 02-06-2009 at 10:55 AM.

  11. #11
    Registered User
    Join Date
    Jan 2009
    Posts
    35
    Quote Originally Posted by matsp View Post
    Rockergal: Why do you put the ; at the beginning of the line.

    --
    Mats
    I placed ; at the start of each line becasue dev C++ was getting funny over it =( it still worked

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by geekrockergal View Post
    I placed ; at the start of each line becasue dev C++ was getting funny over it =( it still worked
    Huh? Well, it's customary to place the semicolon at the end of the line. If you explain what's "funny" about Dev C++ and it's reaction to semicolons, maybe someone can tell you how to fix it.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Registered User
    Join Date
    Feb 2009
    Posts
    8
    haha guys..anyway i finallyt figure how to do it..=D

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem in pass a variable to a class
    By nima_pw in forum C# Programming
    Replies: 3
    Last Post: 06-09-2009, 07:30 AM
  2. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 06:50 PM
  3. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  4. Replies: 3
    Last Post: 12-03-2001, 12:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21