Create main.c

Main code file. Adapted from the tutorial code.