继续蛋定的学习中…加油!

cpp
#include <iostream>
const int Cities = 5;
const int Years = 4;
 
int main()
{
  using namespace std;
  const char * cities[Cities] =
  {
    "Gribble City",
    "Gribbletown",
    "New Gribble",
    "San Gribble",
    "Gribble Vista"
  };
  int maxtemps[Years][Cities] =
  {
    {95, 99, 86, 100, 104},
    {95, 97, 90, 106, 102},
    {96, 100, 940, 107, 105},
    {97, 102, 89, 108, 104}
  };
 
  cout << "Maximum temperatures for 2002 - 2005\n\n";
  for (int city = 0; city < Cities; ++city)
  {
    cout << cities[city] << ":\t";
    for (int year = 0; year < Years; ++year)
      cout << maxtemps[year][city] << "\t";
    cout << endl;
  }
  return 0;
}

半夜三更,挑灯夜战….
这么多的初始化数据..能不让我这么纠结么?

回复 (2)

  1. 13:09, 2010年06月12日Duzan  / 回复

    现在实在没有学东西的头脑了,C Primer Plus(第五版)中文版看了二十多页,停滞了。等俺自考过了,继续钻研。

  2. 15:33, 2010年06月17日Sc千寻  / 回复

    @Duzan
    看C primer Plus干嘛…
    要看就看C++ Primer Plus
    或者C++ Primer
    推荐第一本….

添加回复

允许使用的标签 - 您可以在评论中使用如下的标签。

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

引用通告 (1)

  1. 07:45, 2010年06月26日Favicon of %RICHARD