Myblog's Blog

February 8, 2010

Algorithm for converting a string to an integer value.

Filed under: Uncategorized — technospider @ 6:59 pm

Hints:
1. Check that each character is a numeric character. Take into consideration the base in which the conversion is sought.

2. Identify the character in ASCII and convert it to numeral ’1′ -> 1
3. Iterate over string and Multiply by the appropriate base and add it to temp to find the value of the number.
Also take care that number is -ve

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.