Solved

Number conversion

Posted on 1997-10-21
3
140 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

With the rising number of cyber attacks in recent years, keeping your personal data safe has become more important than ever. The tips outlined in this article will help you keep your identitfy safe.
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

617 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