Hey can someone please help me out

This is a discussion on Hey can someone please help me out within the C++ Programming forums, part of the General Programming Boards category; Im running into a dilema with a c++ question.. If you can please im me at noseshuvit thats my aim ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    11

    Hey can someone please help me out

    Im running into a dilema with a c++ question..

    If you can please im me at noseshuvit thats my aim sn. Thx its about convering inches to centimeters.. Then inches to yards then feet then inches.. I have to make a program that prompts the user to input length then convert the length to inches and ouput the length expressed in yards, feet and inches

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    First, learn to do the math with pencil & paper. Once you know that, then you can start to write the program.

  3. #3
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    What's the dilemma, and why IM you? Why not post it here?
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  4. #4
    ^ Read Backwards^
    Join Date
    Sep 2005
    Location
    Earth
    Posts
    282
    You can either do the math (with pencil & paper) as Ancient Dragon suggested, and then just code that in (it is a REALLY simple program).

    Or you can look up in a Physics or Chemistry handbook the conversion factor. So you can then just take your number and simply multiply it by one other number to get the new value in the new unit.


    Either way…..Why would anybody need to IM you for this?

  5. #5
    Registered User
    Join Date
    Sep 2005
    Posts
    11
    because of the degree of difficulty

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by Joe123
    because of the degree of difficulty
    what don't you understand -- the math or how to write the program. You can look up the math in any 5th grade math book. or see here

  7. #7
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    its not difficult at all unless ur making it a windows program otherwise console ........ like that is easy, best not to post your im ppl will spam u
    New Function!!!!

    glAddIdol(C+noob);

    The feeling of rusty spoons against my salad fingers is almost ORGASMIC

  8. #8
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,806
    psuedo code:
    Code:
    prompt user input
    convert to feet
        output feet
    convert to yards
        output yards
    //do more conversions
    Woop?

  9. #9
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Lightbulb

    Here's what to do:

    - Make a plan. Prog-bman's psudo code is a good example of how to lay-out step-by-step how the program is going to work. I usually start out with an empty main() program except for psudo code written in comment-format. Then, I start adding real code. I'll usually edit (and add-to) the psudo-code comments to better explain the actual code.

    - Start-out with a Hello World program, but change Hello World to Conversion Program or something like that.

    - Test-compile & test-run.

    - Add a cout statement requesting user input.
    - Add a cin statement to get user input.
    - Add a temporary cout statement to display the user input and confirm that everything is OK so far. (You'll need a variable or two also.... Use floats or doubles. If you use ints, you'll have nothing to the right of the decimal point.)

    - Test-compile & test-run.

    - Add one of the conversion-calculation statments. (Inches to centimeters or something.)
    - Add a cout statment to display the results.

    - Test-compile & test-run. Use a calculator to confirm it's working.

    - Add the other calculations, one at a time 'till done. Test-compile & test-run frequently!


    If you need help with some of the above steps, post the code that you have so-far, and explain the problem.

    Assuming that this is homework, your lecture and book should have covered everything you need to know to write the program (cin, cout and basic calculations.). However, your instructor may have assumed that you already know how to make the conversions by hand, or on a calculator.


    Note that all real-world programs are created this way... starting with a small core, and building a little at a time... testing & debugging along the way. But, you can't usually just go "top-to-bottom"... You usually have to figure-out the development sequence, which parts of the program to add next so that the program can be compiled, run and tested before it's complete.

    As you gain experience you'll be able to add more than one or two lines between testing, but your programs will become mrore complex too. So, you'll almost never write an entire program without testing as you go-along.

    For some hints about how to get better answers here, read the Forum Guidelines, when you get a chance. And, take a look at the Homework Policy, and the information about Code Tags.
    Last edited by DougDbug; 09-29-2005 at 06:19 PM.

  10. #10
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Quote Originally Posted by C+noob
    its not difficult at all unless ur making it a windows program otherwise console
    Making it a windows program isn't tough either. You just gotta use a different method of getting input. A method that takes a little more coding, but the way I would do it is using Dialog boxes. Make a Dialog box that has an edit control and a button. When the button is clicked retrieve the number, do the conversions, and output the converted values to a CTEXT control.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    DougDbug is spot on!!!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hey, need help with Dropping ball and Bouncing
    By thynksheraze in forum C++ Programming
    Replies: 2
    Last Post: 02-23-2003, 02:05 PM
  2. Hey
    By REMY in forum C++ Programming
    Replies: 1
    Last Post: 01-22-2003, 10:06 PM
  3. Hey all...
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 11-01-2002, 07:56 PM

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