Code:
for (i = 1; i <= n; i++)

should be

for (i = 0; i < n; i++)
<iostream.h> is an old and now non-standard header.
The correct header is <iostream>

Remember to use code tags when posting code

What compiler are you using?