質問編集履歴

1

回答を参考に書き直したコードを追加しました

2020/07/15 00:01

投稿

_._._ami
_._._ami

スコア26

test CHANGED
File without changes
test CHANGED
@@ -147,3 +147,111 @@
147
147
  9th.inの内容の取得については全くわかりません。
148
148
 
149
149
  この4つをまとめて一枚に書けばいい感じですか?
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ 皆さんの回答を参考に書き直したコードです
158
+
159
+ ```c++
160
+
161
+ #include<iostream>
162
+
163
+ #include<fstream>
164
+
165
+ #include<cmath>
166
+
167
+ using namespace std;
168
+
169
+
170
+
171
+ class A{
172
+
173
+
174
+
175
+ public:
176
+
177
+ double x;
178
+
179
+ double y;
180
+
181
+
182
+
183
+ A() = default;
184
+
185
+
186
+
187
+ //コンストラクタ
188
+
189
+ A(double x,double y){
190
+
191
+ (*this).x = x;
192
+
193
+ (*this).y = y;
194
+
195
+ }
196
+
197
+
198
+
199
+ //長さを計算する関数len
200
+
201
+ double len(){
202
+
203
+ return sqrt((-1.14453-x)*(-1.14453-x) + (0.560077-y)*(0.560077-y));
204
+
205
+ }
206
+
207
+
208
+
209
+ //加算演算子と減算演算子
210
+
211
+ A operator+(A a1){
212
+
213
+ return A((*this).x + a1.x);
214
+
215
+ }
216
+
217
+ A operator-(A a1){
218
+
219
+ return A((*this).x - a1.x)
220
+
221
+ }
222
+
223
+
224
+
225
+ };
226
+
227
+
228
+
229
+ int main(){
230
+
231
+ ifstream ifs("9th.in");
232
+
233
+ if(!ifs) return 1;
234
+
235
+
236
+
237
+ double x,y,x0,y0,r;
238
+
239
+ int n;
240
+
241
+ ifs >> x0 >> y0 >> r >> n;
242
+
243
+
244
+
245
+ cout << boolalpha;
246
+
247
+ for(int i=o;i<n;i++){
248
+
249
+ ifs >> x >> y;
250
+
251
+ cout << (hypot(x - x0,y - y0) < r) << endl;
252
+
253
+ }
254
+
255
+ }
256
+
257
+ ```