C++编程问题,急求助,有没有大神帮我看看怎么做QAQ,题目如图
展开全部
#include <iostream>
using namespace std;
struct Rational
{
int n;
int d;
};
int main()
{
char op;
struct Rational raleft;
cin>>raleft.n>>op>>raleft.d;
struct Rational raright;
cin>>raright.n>>op>>raright.d;
if(raleft.n*raright.d > raright.n * raleft.d)
cout<< raleft.n<<"/"<<raleft.d<<" > "<<raright.n<<"/"<<raright.d<<endl;
if(raleft.n*raright.d == raright.n * raleft.d)
cout<< raleft.n<<"/"<<raleft.d<<" = "<<raright.n<<"/"<<raright.d<<endl;
if(raleft.n*raright.d < raright.n * raleft.d)
cout<< raleft.n<<"/"<<raleft.d<<" < "<<raright.n<<"/"<<raright.d<<endl;
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询