C++ How do I do this one thing?

Discussion in 'Software' started by mbmadiw, Jan 23, 2006.

  1. mbmadiw

    mbmadiw Corporal

    I've written a program to determine the wind chill at different wind speeds after the user enters the temperature. I used all integers, but then I realized that I need to do something because the remainders were being truncated.

    What do I do to make the answer (wind chill) round to the nearest integer? I'm assuming that the temperature and wind speed should be declared integers because they are inputted that way by the user. The book is confusing the heck out of me.

    THANKS!
     
  2. mbmadiw

    mbmadiw Corporal

    I just realized it might help if I attached the text of the program, so here it is.

    THANKS!
     

    Attached Files:

  3. Kodo

    Kodo SNATCHSQUATCH

    temp should be a float, but you should round the final temp.
    my C++ is super super rusty as in I haven't touched it since 97 but I do remember something funky about rounding so I found a link for some rounding functions in C++

    http://cis.stvincent.edu/swd/basic/arithmetic.html (At the bottom of the page)
     
  4. mbmadiw

    mbmadiw Corporal

    I really appreciate you taking the time, despite it having been a while! I'll check it out tomorrow when I have a little bit of time. Thanks!
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds