Answer to Question #231615 in C++ for nawab ul haq

Question #231615

    Program that declares a three dimensional array to store the temperature of a month. The temperature is entered for morning, moon and evening for each day. The first dimension should be used to for three timings of a day, 2nd should be used for 7 days of a week and 3rd dimension should be used for four week of a month. The program should input the temperatures and then display the maximum, minimum and average temperature of a whole month.



1
Expert's answer
2021-08-31T23:52:10-0400
#include <iostream>
using namespace std;


const int c = 2;
const int w = 7;


int main()
{
    int temp[c][w];


    cout << "Enter all temperatures \n";


    for (int i = 0; i < c; ++i)
    {
        for(int j = 0; j < w; ++j)
        {
            cout << "City " << i + 1 << ", Day " << j + 1 << " : ";
            cin >> temp[i][j];
        }
    }
    for (int i = 0; i < c; ++i)
    {
        for(int j = 0; j < w; ++j)
        {
            cout << "City " << i + 1 << ", Day " << j + 1 << " = " << temp[i][j] << endl;
        }
    }


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS