開発環境
- OS: macOS High Sierra - Apple
- IDE(統合開発環境): Visual Studio for Mac
- プログラミング言語: C#
初めてのC# 第2版 (Jesse Liberty (著)、Brian MacDonald (著)、日向 俊二 (翻訳)、オライリージャパン)の8章(メソッド)、8.5(練習問題)、問題8-2.を取り組んでみる。
コード
using System;
namespace Sample8_2
{
class Sample
{
public void DoubleAndTriple(int n, ref int m, ref int l)
{
m = 2 * n;
l = 3 * n;
}
}
class Program
{
static void Main(string[] args)
{
Sample s = new Sample();
int a = 10;
int b = 0;
int c = 0;
s.DoubleAndTriple(a, ref b, ref c);
Console.WriteLine("{0}\n{1}\n{2}", a, b, c);
}
}
}
入出力結果(Terminal)
10 20 30 Press any key to continue...
0 コメント:
コメントを投稿