Solved

pseudocode for ascii to integer

Posted on 2006-11-29
1
526 Views
Last Modified: 2008-01-16
This is sort of a general question, but something that might come up in a job interview.  If someone asked you to write an ascii to integer function in pseudocode for them, how would you go about doing it?
0
Comment
Question by:texasreddog
[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
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 200 total points
ID: 18042568
You do not specify what kind of maping from ascii to integer you want
something as simple as
integer = ascii;
would get an integer  in many languages.
You may want  ord(substr(string,0,1)) at another level of abstraction
If you want to convert an ascii string representation of a decimal numnber, it might be something like
integer=0;
for character in string do
  integer = 10 * integer + ord(character)-ord('0')
end
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
equalIsNot  challenge 43 178
Which programming language is best for beginning Object-oriented programming 11 154
word0 challenge 3 112
WPF issue with Trigger 2 130
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

726 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