-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnested.cpp
More file actions
33 lines (31 loc) · 771 Bytes
/
nested.cpp
File metadata and controls
33 lines (31 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
using namespace std;
const int Cities = 5;
const int Years = 4;
int main(int argc, char *argv[])
{
const char * cities[Cities] = {
"Beijing",
"ShangHai",
"Hangzhou",
"xi'an",
"Shenzhen"
};
int maxtemps[Years][Cities] = {
{96, 100, 78, 101, 106},
{92, 100, 78, 101, 106},
{93, 100, 78, 101, 106},
{99, 100, 78, 101, 106}
};
std::cout << "maximum temperatures for 2008 - 2011" << std::endl;
for(int city = 0; city < Cities; ++city)
{
cout << cities[city] << ":\t";
for(int year = 0; year < Years; year++)
{
std::cout << maxtemps[year][city] << "\t";
}
std::cout << std::endl;
}
return 0;
}