P95460

C++ CH08 01

难度 未定
讨论 统计 0通过 0提交 旧版界面
时间限制 1 秒 内存限制 256 MB

题目描述

已知一个有理数类Zrf_Ratio,实现如下的操作符重载形式:
  friend std::ostream& operator<<(std::ostream&, const zrf_Ratio&);//输出最简分数
  friend std::istream& operator>>(std::istream&, zrf_Ratio&);
  friend bool operator==(const zrf_Ratio&, const zrf_Ratio&);
  friend bool operator<(const zrf_Ratio&, const zrf_Ratio&);

输入

输入四个整数a, b, c, d,表示两个分数a/b和c/d。

输出

输出最简分数以及两个分数相等和大小的比较结果。

样例

样例 1
输入
1 7 26 25
输出
zrf is:1/7; ssh is:26/25
(zrf==ssh) is:0; (zrf<ssh) is:1

来源

蓝桥杯

Tab 缩进 · 提交后可在下方查看评测状态
请先登录后再提交