Many computer programs have been written. While this may seem like a super-obvious statement to make, it is a simple fact often overlooked by programmers. If you have a basic programming task, there is a reasonable chance someone has already written code to do it. The code they have written may not be complete, it may be in a different language or it may not do exactly what you want, but it can be a starting point. Do not overlook the obvious, which is to utilize other programmers as a resource (with their permission, of course, but this is not as much of a problem as you may think; most programmers will share ideas).
You can access this information in several formats. There are many websites dedicated to individual languages and even topics within languages. In additional to web sites with code examples, there are numerous online discussion groups/forums in which you can ask questions, post code samples and read for general ideas. Sourceforge and Freshmeat are two examples of public code repositories, and many others exist. Bookstores generally have a fair supply of books on the languages as well. No matter what resources you use, just remember that you are responsible for any code you run.