The Five Steps

Understand the problem

Do a small example by hand

As an example, let's try the roman number representation of this year:
        M C M X C V

We process the number from left to right:
        M C M X C V
           1000

        M C M X C V
           1000 + 100  = 1100

        M C M X C V
           1100 - 100 + ( 1000 - 100 ) = 1900
                  undo

        M C M X C V
           1900 + 10   = 1910

        M C M X C V
           1910 - 10  + ( 100 - 10 )   = 1990
                 undo

        M C M X C V
           1990 + 5   = 1995

Write an algorithm for solving the problem

Translate the algorithm into a programming language (like C)

Test the program


[up] to Overview.