how to simulate parse using for?

please help!! i have to simulate parse using a loop for!
e.g float=Float.parse(string_of?_characters).how can i do this without using parse??its an old way of programming and i have to find out how!!

Comments

  • Start your number at 0. Step through the string. Each time you hit a digit, multipply your number by 10 then add the numerical value of the digit you hit. Until you hit a decimal point. I'll leave you to work out what you need to do then.

    You also need a little patch for unary plus or minus. Probably you won't be required to parse numbers in scientific notation.


  • thank you very much,youve been very helpful.can you pls give me a simple example so i can understand what you're saying a little better.i get the point but i think an example would help me out.
  • why am i doing this until i hit a decimal point?i have to know the answer by tommorow!any help would be useful
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories