Solved

Number conversion

Posted on 1997-10-21
3
139 Views
Last Modified: 2010-04-16
Please provide the algorithm for converting a three-digit number in words into numeric output. Ex.:
Input: two hundred thirty-five
Output: 235

P.S. I'm using Turbo Pascal 7.0
0
Comment
Question by:chadd082197
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 1216329
You want source code for something like this? For only 50 points?  Better increase the points.  Is this some kind of hw assignment for school
0
 
LVL 9

Accepted Solution

by:
cymbolic earned 50 total points
ID: 1216330
Chadd, let me just give you a general approach to the solution.

1) you need a token parser to examine your string input line, separating out individual number names and Significance names (Like hundred)

You need a table of string names, with their equivalent number strings e.g. (FIVE:5) and (HUNDRED:). Some tokens you need to just eliminate.

Then, you can loop through the input string, on each pass select the next token (substring/word) off the input string,
find this in your table, and add the number string (if any) to you resultant output string.

When out of tokens, either display output string at this point, or
process it further, counting back by threes, and inserting commas, then dispay.

Try it, it's not so hard!

0
 

Author Comment

by:chadd082197
ID: 1216331
Thanks for replying.... I'm increasing the points because I need a bit more explaining done, maybe some pseudocode (if not the actual code). We haven't really gotten into arrays yet, so if there's a simple way of doing this with control loops (return, for, while, case, etc) and strings, that's what I need. Thanks!


0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question