2009年12月17日木曜日

string型の配列を定義して参照し、出力してみる。
using System;


class MainClass
{
    static void Main()
    {
        // string型の配列の宣言と初期化
        string[] seasons = new string[4]{
            "春","夏","秋","冬"};


        // 配列seasonsを出力
        // 春 夏 秋 冬
        int i = 0;
        while (i < 4)
        {
            Console.Write(seasons[i++] + " ");
        }
        // 改行
        Console.WriteLine();
    }
}

0 コメント:

コメントを投稿