1011.A+B和C

這裏寫圖片描述

int _tmain(int argc, _TCHAR* argv[])
{
    int n;
    cin >> n;
    double **num = new double*[n];                       //需用double,否則數組長度不夠
    for (int i = 0; i < n;++i)                           //新建數組
    {
        num[i] = new double[3];
    }
    for (int i = 0; i < n;++i)                          //輸入數組
    {
        for (int j = 0; j < 3;++j)
        {
            cin >> num[i][j];
        }
    }
    for (int i = 0; i < n;++i)                            //判斷並輸出
    {
        cout << "Case #" << i + 1 << ": ";
        if (num[i][0] + num[i][1] > num[i][2])
        {
            cout << "true" << endl;
        }
        else
            cout << "false" << endl;
    }
    return 0;
}
發佈了77 篇原創文章 · 獲贊 1 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章