Thread: How to approach this c program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    5

    How to approach this c program

    i am writing a text based program for a car indicators. to beable switch the left indiactor on the right on and emergency on. e.g if the left is on and i turn the steering wheel left and turn it back to (right) it should automatically switch of jus like a normail car would.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    And what part are you struggling with?

    --
    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.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You should probably start with thinking through the logic -- if A happens, what do I do next? How do I know whether the left blinker is on?

    Then you may need to decide how to get input from your user.

    Once you have both of those, the path forward should be clear(er).

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    5
    yea i kinda kw where to go but im nt sure i was gonna use char input or a string input. the problem is the automaticlly switch off when it returns from a turning.

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    char = one letter. string = more than one letter.

    And the other bit is part of the logic -- the auto switch off needs to be built in from the start.

  6. #6
    Registered User
    Join Date
    Aug 2008
    Posts
    5
    dnt understant use fsd to explain

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by jaykay View Post
    dnt understant use fsd to explain
    What?

  8. #8
    Registered User
    Join Date
    Jul 2008
    Posts
    133
    Quote Originally Posted by tabstop View Post
    What?
    http://en.wikipedia.org/wiki/FSD
    Maybe second one?

  9. #9
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by rasta_freak View Post
    Oh. I thought he had just left vowels out like he'd done with everything else.

    Assuming the first link is what's meant , then "the blinker should turn off after the car finishes turning in that direction" is the fsd. It's your job to turn that into logic.

  10. #10
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Quote Originally Posted by tabstop View Post
    Oh. I thought he had just left vowels out like he'd done with everything else.
    And this here is why we need to insist people not use text-message-speak when requesting help on the forum. You're not chatting up your buddy on what's going on this evening, you're requesting assistance to a problem that requires clarity of communication.

  11. #11
    Registered User
    Join Date
    Aug 2008
    Posts
    5
    already done dat but i come up with an error saying

    error C2143: syntax error : missing ';' before 'type'

  12. #12
    Registered User
    Join Date
    Jul 2008
    Posts
    133
    Ok, tried to compile it and it's OK. Nice game (kind of adventure type), by-the-way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  2. Replies: 1
    Last Post: 12-30-2007, 10:08 AM
  3. Need Delimiter Program helpful hints.
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 02-16-2002, 06:27 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM