I think the main problem is that your global variable y1
may be conflicting with a function defined in math.h
(or cmath
). You can get around that by declaring your variables locally in the main()
function, rather than as globals. That allows the variable name to mask the existing function, and avoids the conflict.
EDIT: The alternative solution would be to rename y1
to something else, e.g. Y1
(upper-case).
There are also a couple of other issues in the code. In two places you've got cout<
instead of cout <<
, and you're also missing a semi-colon.