開発環境
- OS: Windows 10 Pro
- IDE(統合開発環境): Visual Studio Community 2017
初めてのC# 第2版 (Jesse Liberty (著)、Brian MacDonald (著)、日向 俊二 (翻訳)、オライリージャパン)の8章(メソッド)、8.5(練習問題)、問題8-2.を取り組んでみる。
コード
using System;
namespace ConsoleApp2
{
class Program
{
public static void DoublerAndTripler(int a, ref int b, ref int c)
{
b = 2 * a;
c = 3 * a;
}
static void Main(string[] args)
{
int n = 10;
int m = 0;
int l = 0;
Console.WriteLine("{0}, {1}, {2}", n, m, l);
DoublerAndTripler(n, ref m, ref l);
Console.WriteLine("{0}, {1}, {2}", n, m, l);
}
}
}
入出力結果(コマンドプロンプト)
10, 0, 0 10, 20, 30 続行するには何かキーを押してください . . .
0 コメント:
コメントを投稿