回答編集履歴

2

ソース追記

2018/12/13 11:17

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -63,3 +63,57 @@
63
63
  ```
64
64
 
65
65
  勘違いか^^;
66
+
67
+
68
+
69
+ 「結果」
70
+
71
+ usr~/test/c % ./a.out
72
+
73
+ 点数を入力してください:100
74
+
75
+ 点数は100点です
76
+
77
+ usr~/test/c % ./a.out
78
+
79
+ 点数を入力してください:200
80
+
81
+ 点数は100点です
82
+
83
+ usr~/test/c % ./a.out
84
+
85
+ 点数を入力してください:66
86
+
87
+ 点数は66点です
88
+
89
+ usr~/test/c % cat s1.c
90
+
91
+ ```c
92
+
93
+ #include <stdio.h>
94
+
95
+
96
+
97
+ int main(void)
98
+
99
+ {
100
+
101
+ int score;
102
+
103
+ printf("点数を入力してください:");
104
+
105
+ scanf("%d", &score);
106
+
107
+ if (score > 100)
108
+
109
+ score = 100;
110
+
111
+ printf("点数は%d点です\n", score);
112
+
113
+ return 0;
114
+
115
+ }
116
+
117
+ ```
118
+
119
+ usr~/test/c %

1

ソース追記

2018/12/13 11:17

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -1 +1,65 @@
1
1
  "%d , %d" → "%d,%d"・・・空白待ちになっていませんか?
2
+
3
+ う〜〜ん・・・動くようだなぁ
4
+
5
+ usr~/test/c % ./a.out
6
+
7
+ 2 , 3
8
+
9
+ a=2 b=3
10
+
11
+ usr~/test/c % ./a.out
12
+
13
+ 2,3
14
+
15
+ a=2 b=3
16
+
17
+ usr~/test/c % ./a.out
18
+
19
+ 2 , 5
20
+
21
+ a=2 b=5
22
+
23
+ usr~/test/c % ./a.out
24
+
25
+ 2
26
+
27
+ ,
28
+
29
+ 2
30
+
31
+ a=2 b=2
32
+
33
+ ```c
34
+
35
+ usr~/test/c % cat s1.c
36
+
37
+ #include <stdio.h>
38
+
39
+
40
+
41
+ int main()
42
+
43
+ {
44
+
45
+ int a, b;
46
+
47
+
48
+
49
+ if(scanf("%d , %d",&a, &b)!=2){
50
+
51
+ return 1;
52
+
53
+ }
54
+
55
+ printf("a=%d b=%d\n", a, b);
56
+
57
+
58
+
59
+ return 0;
60
+
61
+ }
62
+
63
+ ```
64
+
65
+ 勘違いか^^;