Did it say anything about local function definitions being illegal?

You have to move it outside of main().

Oh, and it's <iostream>, not <iostream.h> (you'll need a using namespace std; in there after the includes).