Decimal numbers in C++

Discussion in 'Software' started by N80, Nov 2, 2007.

  1. N80

    N80 Private E-2

    Is there anyway to use decimal numbers in C++?

    I don't know that much about number types
    (
    Code:
    double long unsigned (etc.)
    so maybe there's just some type I don't know about :confused
     
  2. N80

    N80 Private E-2

    does float work?
     
  3. Akumos

    Akumos Private E-2

    yeah float is your answer

    eg.
    float a = 10;
     
  4. PC-XT

    PC-XT Master Sergeant

    What exactly do you mean by decimal? That is, do you care about the form: actual binary floating-point numbers (like float or double) or something else like BCD or string representation or fixed-decimal? or do you just want to be able to store the number 17.62 or whatever. If you don't care, float is pretty much just a smaller version of double, and either can handle decimal numbers, though double is more precise.
     

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