回答編集履歴

3

ソース修正

2019/10/29 11:08

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -13,6 +13,12 @@
13
13
  2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
14
14
 
15
15
  Error: input is -16
16
+
17
+ usr ~/Project/test % ./a.out
18
+
19
+ 0 1 2 3 -1
20
+
21
+ 1 2 3 4
16
22
 
17
23
  ```
18
24
 

2

ソース修正

2019/10/29 11:08

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  int num = 0;
34
34
 
35
- do {
35
+ while(num != -1) {
36
36
 
37
37
  cin >> num;
38
38
 
@@ -48,7 +48,7 @@
48
48
 
49
49
  }
50
50
 
51
- } while (num != -1);
51
+ }
52
52
 
53
53
  cout << endl;
54
54
 

1

ソース修正

2019/10/29 11:02

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -8,9 +8,11 @@
8
8
 
9
9
  usr ~/Project/test % ./a.out
10
10
 
11
- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 -16 -1
11
+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 -16 -1
12
12
 
13
- 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Error: input is -16
13
+ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
14
+
15
+ Error: input is -16
14
16
 
15
17
  ```
16
18
 
@@ -40,7 +42,7 @@
40
42
 
41
43
  } else if (num != -1) {
42
44
 
43
- cerr << "Error: input is " << num << endl;
45
+ cerr << endl << "Error: input is " << num;
44
46
 
45
47
  break;
46
48