#蒟蒻萌新求助
查看原帖
#蒟蒻萌新求助
939641
LBlue楼主2023/4/22 16:20

只能输入一个怎么办

#include<iostream>
using namespace std;
int main()
{
    int n,Cocktail[3],other1,other2;
    double t1,t2;
    cin >> n;
    cin >> Cocktail[1] >> Cocktail[2];
    t1 = 1.0 * Cocktail[1] / Cocktail[2];
    for(int i = 2;i <= n;i++)
    {
        cin >> other1 >> other2;
        t2 = 1.0 * other1 / other2;
        if(t2 - t1 > 0.05)
            cout << "better" << endl;
        else if(t1 - t2 > 0.05)
            cout << "worse" << endl;
        else
            cout << "same" << endl;
        return 0;
    }
}

   

请问各位该怎么修改

2023/4/22 16:20
加载中...