首页 > 试题广场 >

重载运算符

[编程题]重载运算符
  • 热度指数:4400 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32M,其他语言64M
  • 算法知识视频讲解
建立一个角类,在这个类中重载减号运算符角度相减,并实现求出角度的正弦值的函数

输入描述:
输入第一行为样例数m,接下来有m行每行两个整数表示角度。


输出描述:
输出m行,表示两角相减的正弦值,保留小数点后两位。
示例1

输入

1
60 30

输出

0.50
头像 用户抉择
发表于 2021-03-30 21:15:00
#include <stdio.h> #include <math.h> #define PI 3.1415926 int main(){     int n,a,b; &nb 展开全文
头像 牛客440904392号
发表于 2024-10-04 01:08:54
from math import radians, sin class Angle: def __init__(self, degrees): self.degrees = degrees def __sub__(self, other): retur 展开全文
头像 笑川不吃香菜
发表于 2024-03-18 20:04:37
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { float n,a,b;cin>>n; //圆周率 展开全文
头像 打怪升级小透明
发表于 2024-01-08 22:54:26
#include <iostream> #include <cmath> #define PI 3.1415926535 using namespace std; class Angle{ public: int degree; A 展开全文
头像 bbq了的独行侠很贪玩
发表于 2025-03-20 08:53:04
#include <iostream> #include <cmath> using namespace std; double sub(int a, int b){ return sin((a - b) * 3.14159 / 180);//sin(pi/6) } 展开全文

问题信息

上传者:小小
难度:
24条回答 3292浏览

热门推荐

通过挑战的用户

查看代码
重载运算符