質問編集履歴

1

進展したので続きを追記します

2022/12/23 08:55

投稿

motch_misa_ore
motch_misa_ore

スコア15

test CHANGED
File without changes
test CHANGED
@@ -25,7 +25,49 @@
25
25
  }
26
26
  }
27
27
  cout << endl;
28
+ ```
29
+
30
+ 以上よろしくお願いいたします。
31
+
32
+
33
+ 20221223追記
34
+ 皆様のおかげで入力しなおしの条件や動作について少し進展しました。あともう少しのところです。doの{}内をどうにかする必要がありそうです。どうでしょうか…?
35
+ ```C++(改善後)
36
+ cout << "x?" << endl;
37
+ for(i=0;i<N;i++){
38
+ for(j=0;j<N;j++){
39
+ do{
40
+ cout << "x["<< i <<"]["<< j <<"]?----------->";
41
+ cin >> x[i][j];
42
+ if(cin.fail()!=0)
43
+ cout << "Input only number!" << endl;
44
+ else break;
45
+ }while(1);
46
+
47
+ }
48
+ }
49
+ cout << endl;
50
+ ```
51
+ 以下がエラーです。
52
+ ```
53
+ PS C:\Users\motch\java> g++ Loop1_C++_20221222.cpp -o Loop1_C++_20221222 ; .\Loop1_C++_20221222
54
+ Input some real numbers
55
+ How many rows and columns does the matrix have?3
56
+ x?
57
+ x[0][0]?----------->1
58
+ x[0][1]?----------->2
59
+ x[0][2]?----------->3
60
+ x[1][0]?----------->4
61
+ x[1][1]?----------->5
62
+ x[1][2]?----------->6
63
+ x[2][0]?----------->l
64
+ Input only number!
65
+ x[2][0]?----------->Input only number!
66
+ x[2][0]?----------->Input only number!
67
+ x[2][0]?----------->Input only number!
68
+ x[2][0]?----------->Input only number!
69
+ x[2][0]?----------->Input only number!
70
+ x[2][0]?----------->Input only number!
71
+ x[2][0]?----------->Input only number!
28
72
 
29
73
  ```
30
- 以上よろしくお願いいたします。
31
-