Thread: Car Inventory Program

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    3

    Unhappy Car Inventory Program

    14

    Hi. I am working on a car inventory program that asks the user to enter a certain number of cars. The user then must enter the make, model, year, color and price. This data must be stored within a structure. The program then lists them sorted by make (a to z), model (a to z), year (newest to oldest), color(a to z), or list them sorted by price (cheapest to most expensive). The program then exits. I understand the basic idea of the program, I am just having trouble getting started. Can someone just give me an idea on how to get started? Any suggestions would be appreciated! By the way, the program is in C.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    int main( void )
    {
       return 0;
    }
    There's a good place to start.

    Quzah.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    3
    Oh I see. So this is a place for sarcasm? And people cannot ask for help? Gee thanks a million.... I really appreciate it!

  4. #4
    Registered User lliero's Avatar
    Join Date
    Oct 2001
    Posts
    59

    Lightbulb

    gather all input..

    such as model year color etc...
    think how can you implement them..


    ok?




    if they can do it, you can do it too!

  5. #5
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Ignore quzah's humor (I thought it was slightly funny). What you basically want to do is get data from the user (with the fgets & sscanf combo -- not scanf) and store it where you want.

    Does this help?

    --Garfield the Programmer/Pianist/Surfer
    1978 Silver Anniversary Corvette

  6. #6
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Arg!!! Oskilian, you beat me to it! I really hate it when that happens.

    Well, Osky has the right idea.
    1978 Silver Anniversary Corvette

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > Oh I see. So this is a place for sarcasm?

    Yup.

    > And people cannot ask for help?

    They can, provided two things:
    1) they read:
    http://www.cprogramming.com/cboard/a...php?forumid=10

    2) they show they've at least made an effort

    You've done neither.

    > Gee thanks a million.... I really appreciate it!

    Glad to help.

    Seriously, what did you expect, me to write your whole program for you? If you understand the problem, then break it down into steps, and write code for them:
    Code:
    while ! done
       prompt for car info or sotring
       read input
       parse input
       if car info selected
          put car info into car info structure
          put car in list
       if sort selected
          sort
       if display selected
          display
    What exactly do you need? It's not a tough assignment. Or rather, it's no SO tough that you can't even freeking try. Trying and failing is better than never trying at all. If it wasn't, I wouldn't be being sarcastic and short with you. Instead I'd be praising you for not even bothering to try, which is obviously NOT the case.

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    Registered User
    Join Date
    Nov 2001
    Posts
    3
    >Seriously, what did you expect, me to write your whole program for you? If you understand the problem, then break it down into steps, and write code for them

    No of course I didn't expect anyone to write the program for me. Nor would I want anyone to write the program for me. If I had a clear understanding of it, I would be working on it right now. But I am very confused and don't know where to start. I thought maybe I could get some help here and be able to get started on it, but I guess not....

  9. #9
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > But I am very confused and don't know where to start. I
    > thought maybe I could get some help here and be able to get
    > started on it, but I guess not....

    I just gave you a step by step process on how to start. Here,
    since that's too complex, I'll break it down:

    1) Do you know how to send text to the standard output stream (the screen)?

    There's a good place to start. How about a nice little text menu display?

    2) Do you know how to read input?

    There's a good place to pick up after you've put some output on the screen.

    3) Do you know how to check your data for a given result?

    Ah, now there's a supurb followup to reading data!

    Put this all in a loop, and you're half way done.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fixing my program
    By Mcwaffle in forum C Programming
    Replies: 5
    Last Post: 11-05-2008, 03:55 AM
  2. Replies: 26
    Last Post: 06-15-2005, 02:38 PM
  3. I need help with an algorithm
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-07-2002, 07:58 PM
  4. car program
    By lostgirls in forum C++ Programming
    Replies: 12
    Last Post: 03-23-2002, 01:11 AM