回答編集履歴
1
追記
test
CHANGED
@@ -31,3 +31,79 @@
|
|
31
31
|
↓
|
32
32
|
|
33
33
|
order(&x, &y);
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
### 追記
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
C# の場合
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
using System;
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
namespace ConsoleApp1
|
50
|
+
|
51
|
+
{
|
52
|
+
|
53
|
+
class Program
|
54
|
+
|
55
|
+
{
|
56
|
+
|
57
|
+
static void Main()
|
58
|
+
|
59
|
+
{
|
60
|
+
|
61
|
+
static int Prompt(string message)
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
Console.Write(message);
|
66
|
+
|
67
|
+
return int.Parse(Console.ReadLine());
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
static void Dump(string name, int n)
|
74
|
+
|
75
|
+
{
|
76
|
+
|
77
|
+
unsafe
|
78
|
+
|
79
|
+
{
|
80
|
+
|
81
|
+
Console.WriteLine($"{name}:address={(int)&n:X},value={n}.");
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
int x = Prompt("Input x:");
|
90
|
+
|
91
|
+
int y = Prompt("Input y:");
|
92
|
+
|
93
|
+
if (x > y)
|
94
|
+
|
95
|
+
{
|
96
|
+
|
97
|
+
(x, y) = (y, x);
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
Dump(nameof(x), x);
|
102
|
+
|
103
|
+
Dump(nameof(y), y);
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|