2 回答

TA贡献2条经验 获得超1个赞
#include<stdio.h> int main() { int a, b, c, d; printf("Input a/b, c/d:"); scanf("%d/%d,%d/%d", &a, &b, &c, &d); if(a*d < c*b) { printf("%d/%d<%d/%d\n",a,b,c,d); } if(a*d > c*b) { printf("%d/%d>%d/%d\n",a,b,c,d); } if(a*d == c*b) { printf("%d/%d=%d/%d\n",a,b,c,d); } return 0; }
c语言实现

TA贡献2条经验 获得超1个赞
#include <iostream>
#include <stdlib.h>
using namespace std;
template <class T>
int find(T a, T b)
{
double team;
team = a / b;
return team;
}
int main()
{
double a1 , b1, c , d;
cout << "输入两个数 以空格为间隔" << endl;
cin >> a1 >> b1;
cout << "再次输入两个数" << endl;
cin >> c >> d;
if (find(a1, b1) == find(c, d))
{
cout <<"比较的结果:"<< a1 << "/" << b1 << " = " << c << "/" << d << endl;
}
if (find(a1, b1) > find(c, d))
{
cout << "比较的结果:" << a1 << "/" << b1 << " > " << c << "/" << d << endl;
}
if (find(a1, b1) < find(c, d))
{
cout << "比较的结果:" << a1 << "/" << b1 << " < " << c << "/" << d << endl;
}
system("pause");
return 0;
}
- 2 回答
- 0 关注
- 5719 浏览
添加回答
举报