質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,9 +24,9 @@
|
|
24
24
|
|
25
25
|
### 該当のソースコード
|
26
26
|
|
27
|
-
以前は書いておりましたが、コード
|
27
|
+
以前は書いておりましたが、いろんなコードを参考にしていた為、一度著作権など理解してから書き直したいと思います。
|
28
28
|
|
29
|
-
|
29
|
+
申し訳ありません。
|
30
30
|
|
31
31
|
|
32
32
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
```ここに言語を入力
|
2
|
+
|
3
|
+
コード
|
4
|
+
|
1
|
-
### 前提・実現したいこと
|
5
|
+
```### 前提・実現したいこと
|
2
6
|
|
3
7
|
電卓アプリの完成
|
4
8
|
|
@@ -20,211 +24,13 @@
|
|
20
24
|
|
21
25
|
### 該当のソースコード
|
22
26
|
|
23
|
-
|
27
|
+
以前は書いておりましたが、コードの著作権をもう一度理解してから書き直したいと思います。
|
24
28
|
|
25
29
|
```ここに言語名を入力
|
26
30
|
|
27
|
-
import UIKit
|
28
31
|
|
29
32
|
|
30
|
-
|
31
|
-
|
33
|
+
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
var number1: Int = 0
|
36
|
-
|
37
|
-
var number2: Int = 0
|
38
|
-
|
39
|
-
var number3: Int = 0
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
var ope : Int = 0
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
@IBOutlet var label: UILabel!
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
override func viewDidLoad() {
|
52
|
-
|
53
|
-
super.viewDidLoad()
|
54
|
-
|
55
|
-
// Do any additional setup after loading the view.
|
56
|
-
|
57
|
-
}
|
58
|
-
|
59
|
-
@IBAction func select0(){
|
60
|
-
|
61
|
-
number1 = number1*10 + 0
|
62
|
-
|
63
|
-
label.text = String(number1)
|
64
|
-
|
65
|
-
}
|
66
|
-
|
67
|
-
@IBAction func select1(){
|
68
|
-
|
69
|
-
number1 = number1*10 + 1
|
70
|
-
|
71
|
-
label.text = String(number1)
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
@IBAction func select2(){
|
76
|
-
|
77
|
-
number1 = number1*10 + 2
|
78
|
-
|
79
|
-
label.text = String(number1)
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
@IBAction func select3(){
|
84
|
-
|
85
|
-
number1 = number1*10 + 3
|
86
|
-
|
87
|
-
label.text = String(number1)
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
@IBAction func select4(){
|
92
|
-
|
93
|
-
number1 = number1*10 + 4
|
94
|
-
|
95
|
-
label.text = String(number1)
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
@IBAction func select5(){
|
100
|
-
|
101
|
-
number1 = number1*10 + 5
|
102
|
-
|
103
|
-
label.text = String(number1)
|
104
|
-
|
105
|
-
}
|
106
|
-
|
107
|
-
@IBAction func select6(){
|
108
|
-
|
109
|
-
number1 = number1*10 + 6
|
110
|
-
|
111
|
-
label.text = String(number1)
|
112
|
-
|
113
|
-
}
|
114
|
-
|
115
|
-
@IBAction func select7(){
|
116
|
-
|
117
|
-
number1 = number1*10 + 7
|
118
|
-
|
119
|
-
label.text = String(number1)
|
120
|
-
|
121
|
-
}
|
122
|
-
|
123
|
-
@IBAction func select8(){
|
124
|
-
|
125
|
-
number1 = number1*10 + 8
|
126
|
-
|
127
|
-
label.text = String(number1)
|
128
|
-
|
129
|
-
}
|
130
|
-
|
131
|
-
@IBAction func select9(){
|
132
|
-
|
133
|
-
number1 = number1*10 + 9
|
134
|
-
|
135
|
-
label.text = String(number1)
|
136
|
-
|
137
|
-
}
|
138
|
-
|
139
|
-
@IBAction func clear(){
|
140
|
-
|
141
|
-
number1 = 0
|
142
|
-
|
143
|
-
label.text = String(number1)
|
144
|
-
|
145
|
-
}
|
146
|
-
|
147
|
-
@IBAction func equal(){
|
148
|
-
|
149
|
-
if ope == 1 {
|
150
|
-
|
151
|
-
//プラスの時
|
152
|
-
|
153
|
-
number3 = number2 + number1
|
154
|
-
|
155
|
-
} else if ope == 2{
|
156
|
-
|
157
|
-
//マイナスの時
|
158
|
-
|
159
|
-
number3 = number2 - number1
|
160
|
-
|
161
|
-
} else if ope == 3{
|
162
|
-
|
163
|
-
//かける時
|
164
|
-
|
165
|
-
number3 = number2 * number1
|
166
|
-
|
167
|
-
} else if ope == 4{
|
168
|
-
|
169
|
-
//わる時
|
170
|
-
|
171
|
-
number3 = number2 / number1
|
172
|
-
|
173
|
-
}
|
174
|
-
|
175
|
-
label.text = String(number3)
|
176
|
-
|
177
|
-
}
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
@IBAction func plus(){
|
182
|
-
|
183
|
-
number2 = number1
|
184
|
-
|
185
|
-
number1 = 0
|
186
|
-
|
187
|
-
ope = 1
|
188
|
-
|
189
|
-
}
|
190
|
-
|
191
|
-
@IBAction func minus(){
|
192
|
-
|
193
|
-
number2 = number1
|
194
|
-
|
195
|
-
number1 = 0
|
196
|
-
|
197
|
-
ope = 2
|
198
|
-
|
199
|
-
}
|
200
|
-
|
201
|
-
@IBAction func kakeru(){
|
202
|
-
|
203
|
-
number2 = number1
|
204
|
-
|
205
|
-
number1 = 0
|
206
|
-
|
207
|
-
ope = 3
|
208
|
-
|
209
|
-
}
|
210
|
-
|
211
|
-
@IBAction func waru(){
|
212
|
-
|
213
|
-
number2 = number1
|
214
|
-
|
215
|
-
number1 = 0
|
216
|
-
|
217
|
-
ope = 4
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
}
|
224
|
-
|
225
|
-
```
|
226
|
-
|
227
|
-
|
228
34
|
|
229
35
|
### 試したこと
|
230
36
|
|