Thread: Replacing a Decimal with a letter in a numeric variable.

  1. #1
    Registered User
    Join Date
    Dec 2003

    Replacing a Decimal with a letter in a numeric variable.

    I need to replace a Numeric variable containing a decimal such as 130.25 to have the decimal changed to a P such as 130P25. The software I am writing this program for does not recognize a decimal in the naming convention. Does anyone have a clue how this might work. The main problem is the the numbers before and after the decimal can vary in length. So the TAKE command wasn't working. IS there a way to make the program hold 000.00 as the place holder so that a number lik 5.3 would turn into 005.30?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Create a string out of it, then use the replace() method to replace the dot with a P
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replacing an Event with a boolean variable.
    By Hunter2 in forum Windows Programming
    Replies: 2
    Last Post: 08-13-2008, 01:49 PM
  2. Big Letter became small letter
    By cogeek in forum C Programming
    Replies: 27
    Last Post: 12-13-2004, 02:04 PM
  3. Problem with a char variable set as a letter
    By 7smurfs in forum C++ Programming
    Replies: 6
    Last Post: 12-10-2004, 01:25 PM
  4. Beginner question
    By Tride in forum C Programming
    Replies: 30
    Last Post: 05-24-2003, 08:36 AM
  5. Replies: 13
    Last Post: 08-15-2002, 09:20 AM