lundi 23 mars 2020

C "if" statement is not printing an output

I'm sorry if this has been asked many times before. I'm a beginner coder and I'm supposed to find the coldest and warmest overall temperatures of a group of lakes. My "if" statements are not printing an output. I was wondering why this may be? Any help is greatly appreciated. Thank you.

void
overallColdestWarmest()
{
    printf("\n----- PART FOUR -----\n");

    double a1, b1, c1, d1, e1, f1;

    a1 = temp[0][(int)entries[0][0]];
    b1 = temp[1][(int)entries[1][0]];
    c1 = temp[2][(int)entries[2][0]];
    d1 = temp[3][(int)entries[3][0]];
    e1 = temp[4][(int)entries[4][0]];
    f1 = temp[5][(int)entries[5][0]];

    if(a1 < b1 && a1 < c1 && a1 < d1 && a1 < e1 && a1 < f1)
    {
        printf("Lake Superior has the overall coldest temp of %.2lf on .\n", a1);
        date(entries[0][0]);
    }
    else
    {
        if(b1 < a1 && b1 < c1 && b1 < d1 && b1 < e1 && b1 < f1)
        {
            printf("Lake Michigan has the overall coldest temp of %.2lf on .\n", b1);
            date(entries[1][0]);
        }
        else
        {
            if(c1 < a1 && c1 < b1 && c1 < d1 && c1 < e1 && c1 < f1)
            {
                printf("Lake Huron has the overall coldest temp of %.2lf on .\n", c1);
                date(entries[2][0]);
            }
            else
            {
                if(d1 < a1 && d1 < b1 && d1 < c1 && d1 < e1 && d1 < f1)
                {
                    printf("Lake Erie has the overall coldest temp of %.2lf on .\n", d1);
                    date(entries[3][0]);
                }
                else
                {
                    if(e1 < a1 && e1 < b1 && e1 < c1 && e1 < d1 && e1 < f1)
                    {
                        printf("Lake Ontario has the overall coldest temp of %.2lf on .\n", e1);
                        date(entries[4][0]);
                    }
                    else
                    {
                        if(f1 < a1 && f1 < b1 && f1 < c1 && f1 < d1 && f1 < e1)
                        {
                            printf("Lake St. Clair has the overall coldest temp of %.2lf on .\n", f1);
                            date(entries[5][0]);
                        }
                    }
                }
            }
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire