I am writing a program that converts arabic numbers to mayan numbers and vice versa. I got the converting arabic numbers to mayan down perfect but I am really struggling to write a function converting mayan numbers to arabic. incase you don't know arabic numbers are regular 1 2 3 numbers and mayan numbers are represented by 0 . and -
the conversion table looks like this

I read in the Mayan number as a char array and now have to create a function that converts the mayan number and returns an arabic number. This is what I have written so far but I am afraid I went in the completely wrong direction and there is a much easier way to solve this than I am attempting to. Any help would be great, Thanks!

How is this written backwards? That's how we would normally write in a positional base system. (Largest exponent on the left, just like in base ten).

10-02-2008

master5001

Either way, strtol() handles arbitrary bases (within limitation). So you should be fine just converting strings strtol() can digest to mayan format and back. I had to do that for a barcoding system that I wrote a while back. I used a base 25 system that converted to and fro.