pulled code snippets from the website ideone, that successfully compile