I am using this program to find values of some trigonometric functions. However, when I try to print (sin 90 for example) it gives me 0.893997 when in fact it should be 1. I tried other values and the same problem persists. What is the problem here. This is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
include <iostream>
# include <cmath>
usingnamespace std;
int main ()
{
int x, y;
y = 5/4;
int *p;
p = &x;
cin>> *p;
cin.ignore();
cout<< *p << "\n";
cout << sin (90) << "\n";
cin.get();
}
#include <iostream>
# include <cmath>
usingnamespace std;
int main ()
{
int x;
float y;
y = 5/4;
int *p;
p = &x;
cin>> *p;
cin.ignore();
cout<< *p << "\n";
cout<< y << "\n";
cout << sin (0.785) << "\n";
cin.get();
}