Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Thousands Separator

Thousands Separator

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BRIMID
    wrote on last edited by
    #1

    How do you include a thousands separator in a C++ program. The separator:eek: will be used for input i.e., 2,000 and output i.e., 2,000. For now the input is more important. For example you will be prompted to enter Your Amount: $2,000.00. When I run this now the comma throws the whole calculation off.

    M 1 Reply Last reply
    0
    • B BRIMID

      How do you include a thousands separator in a C++ program. The separator:eek: will be used for input i.e., 2,000 and output i.e., 2,000. For now the input is more important. For example you will be prompted to enter Your Amount: $2,000.00. When I run this now the comma throws the whole calculation off.

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      (assuming you have a UI with somesort of edit box ) you need a masked edit that will do the job of converting the string to a valid number. http://www.codeproject.com/editctrl/#Masked+and+Validating+controls or maybe, just thinking about it, use some of the localization API, for example GetNumberFormat


      Maximilien Lincourt Your Head A Splode - Strong Bad

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups