C++编程问题,急求助,有没有大神帮我看看怎么做QAQ,题目如图

2024-12-25 16:06:31
推荐回答(1个)
回答1:

#include 

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<<"/"< "<
    if(raleft.n*raright.d == raright.n * raleft.d)
        cout<< raleft.n<<"/"<
    if(raleft.n*raright.d < raright.n * raleft.d)
        cout<< raleft.n<<"/"<
    return 0;
}