Convert a String to a Number

Project

In a loop, ask the user to input a number (a string containing only characters 0..9). Convert the input string to a number.

Start simple ... First a, next b, ...

  1. unsigned integer (123)
  2. unsigned float (123.45)
  3. signed integer ([+-]123)
  4. signed float ([+-]123.45)
  5. scientific notation ([ +-]123.45[eE][ +-]10)

Hint

Draw a state diagram before coding. This will help you design your code.

(ask the instructor about state diagrams)

State Diagram (Wikipedia)