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