Solved

pseudocode for ascii to integer

Posted on 2006-11-29
1
570 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This video teaches viewers about errors in exception handling.

729 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