Joining two programs together

Any help will come after you do several things. First, and most important is to fix your post, and post the code properly. Select each program and use the icon with the # symbol to add code tags, to prevent the mangling that has happened with your code.

Second, you must define the requirements for your combined program.

Third, you must post your attempt to combine them.

Finally, I'm pretty sure the compiler was a bit more specific than "loads of errors.". What errors?