2009年12月18日金曜日

算術演算子+を使用し、いろいろなデータ型のオペラントを足してみる。
using System;


class MainClass
{
    static void Main()
    {
        int a = 1;
        int b = 2;
        double c = 1.1;
        double d = 1.2;
        string e = "Hello,";
        string f = "World!";


        // 出力値:3
        Console.WriteLine(a + b);


        // 出力値:2.3
        Console.WriteLine(c + d);


        // 出力値:Hello,World!
        Console.WriteLine(e + f);
    }
}

0 コメント:

コメントを投稿