Yahoo Answers is shutting down on 4 May 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 week ago

C++ HW Help - How do you  get output to look like the image below?

Here's what I have so far:

#include<iostream>

using namespace std;

void getData(int[][12]);

double averageHigh(int[][12]);

double averageLow(int[][12]);

int indexHighTemp(int[][12]);

int indexLowTemp(int[][12]);

int main()

{

    int temp[2][12];

    cout << "Enter high temperature for each month\n";

    getData(temp);

    double avgH = averageHigh(temp);

    double avgL = averageLow(temp);

    int inH = indexHighTemp(temp);

    int inL = indexLowTemp(temp);

    cout << "\nAverage high temperature:\t" << avgH;

    cout << "\nAverage low temperature:\t" << avgL;

    cout << "\nHighest temperature:\t" << temp[0][inH];

    cout << "\nLowest temperature:\t" << temp[1][inL];

    return 0;

}

void getData(int a[2][12])

{

    for (int i = 0; i < 2; i++)

    {

        for (int j = 0; j < 12; j++)

        {

            cin >> a[i][j];

        }

    }

}

Attachment image

1 Answer

Relevance
  • EddieJ
    Lv 7
    1 week ago

    I used to get about 2 Best Answers in this section every day, on average, but I haven't gotten one here for about 4 weeks.

Still have questions? Get answers by asking now.