PAT乙级:1011. A+B和C (C++程序)

题目要求(https://img-blog.csdn.net/20180906230220651?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80Mjk2MzYxOA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)


#include <iostream>
using namespace std;

int main(){
    int n;
    cin>>n;
    double a,b,c;
    bool *result = new bool[n+1];
    for(int i=1;i<=n;i++){
        cin>>a>>b>>c;
        result[i] = false;
        if(a+b>c){
            result[i] = true;
        }
    }

    for(int i=1;i<=n;i++){
        cout<<"Case #"<<i<<": ";
        if (result[i])
        {
            cout<<"true"<<endl;
        } 
        else
        {
            cout<<"false"<<endl;
        }
    }
    system("pause");
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43150428/article/details/82469906