Solved

pseudocode for ascii to integer

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Title # Comments Views Activity
only14 challenge 19 81
NotAlone Challenge 20 84
Problem to error 4 67
Work with App store 7 68
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…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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