回答編集履歴
1
追記
answer
CHANGED
|
@@ -14,4 +14,42 @@
|
|
|
14
14
|
|
|
15
15
|
void order(int x,int y);
|
|
16
16
|
↓
|
|
17
|
-
order(&x, &y);
|
|
17
|
+
order(&x, &y);
|
|
18
|
+
|
|
19
|
+
### 追記
|
|
20
|
+
|
|
21
|
+
C# の場合
|
|
22
|
+
|
|
23
|
+
using System;
|
|
24
|
+
|
|
25
|
+
namespace ConsoleApp1
|
|
26
|
+
{
|
|
27
|
+
class Program
|
|
28
|
+
{
|
|
29
|
+
static void Main()
|
|
30
|
+
{
|
|
31
|
+
static int Prompt(string message)
|
|
32
|
+
{
|
|
33
|
+
Console.Write(message);
|
|
34
|
+
return int.Parse(Console.ReadLine());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static void Dump(string name, int n)
|
|
38
|
+
{
|
|
39
|
+
unsafe
|
|
40
|
+
{
|
|
41
|
+
Console.WriteLine($"{name}:address={(int)&n:X},value={n}.");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
int x = Prompt("Input x:");
|
|
46
|
+
int y = Prompt("Input y:");
|
|
47
|
+
if (x > y)
|
|
48
|
+
{
|
|
49
|
+
(x, y) = (y, x);
|
|
50
|
+
}
|
|
51
|
+
Dump(nameof(x), x);
|
|
52
|
+
Dump(nameof(y), y);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|