Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Point{
- int x, y;
- }point;
- char sign_sin(Point p){
- if(p.y>0){
- return '+';
- }else{
- return '-';
- }
- }
- char sign_cos(Point p){
- if(p.x>0){
- return '+';
- }else{
- return '-';
- }
- }
- char sign_tan(Point p){
- if(p.x>0 && p.y>0 || p.x<0 && p.y<0){
- return '+';
- }else{
- return '-';
- }
- }
- int main(){
- int x, y;
- while(cin >> x >> y){
- if(x==0 || y==0){
- cout << "Invalid point! either x or y located in their axis. Enter a new point : " << endl;
- continue;
- }
- point.x = x;
- point.y = y;
- cout << "sin " << sign_sin(point) << endl;
- cout << "cos " << sign_cos(point) << endl;
- cout << "tan " << sign_tan(point) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement