質問編集履歴
2
エラーの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,6 +50,36 @@
|
|
50
50
|
|
51
51
|
}
|
52
52
|
|
53
|
+
#fと置く前に実行したときに出るエラー
|
54
|
+
|
55
|
+
Compilation error #stdin compilation error #stdout 0s 4564KB
|
56
|
+
|
57
|
+
prog.c: In function ‘main’:
|
58
|
+
|
59
|
+
prog.c:17:18: error: lvalue required as left operand of assignment
|
60
|
+
|
61
|
+
else if(b*b-4*a*c=0){
|
62
|
+
|
63
|
+
^
|
64
|
+
|
65
|
+
prog.c:6:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
|
66
|
+
|
67
|
+
scanf("%d\n",&a);
|
68
|
+
|
69
|
+
^~~~~~~~~~~~~~~~
|
70
|
+
|
71
|
+
prog.c:8:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
|
72
|
+
|
73
|
+
scanf("%d\n",&b);
|
74
|
+
|
75
|
+
^~~~~~~~~~~~~~~~
|
76
|
+
|
77
|
+
prog.c:10:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
|
78
|
+
|
79
|
+
scanf("%d\n",&c);
|
80
|
+
|
81
|
+
^~~~~~~~~~~~~~~~
|
82
|
+
|
53
83
|
#fと置いた後
|
54
84
|
|
55
85
|
int main(void) {
|
1
fと置く前のコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,9 +2,55 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
#
|
5
|
+
#fと置く前
|
6
6
|
|
7
|
+
int main(void) {
|
8
|
+
|
9
|
+
int a,b,c;
|
10
|
+
|
11
|
+
printf("整数 a を入力してください");
|
12
|
+
|
13
|
+
scanf("%d\n",&a);
|
14
|
+
|
15
|
+
printf("整数 b を入力してください");
|
16
|
+
|
17
|
+
scanf("%d\n",&b);
|
18
|
+
|
19
|
+
printf("整数 c を入力してください");
|
20
|
+
|
21
|
+
scanf("%d\n",&c);
|
22
|
+
|
23
|
+
double d,e;
|
24
|
+
|
25
|
+
if(b*b-4*a*c>0){
|
26
|
+
|
27
|
+
d=((double)-b+sqrt((double)b*b-4*a*c))/(2*a);
|
28
|
+
|
29
|
+
e=((double)-b-sqrt((double)b*b-4*a*c))/(2*a);
|
30
|
+
|
31
|
+
printf("実数解は%fと%fです",d,e);
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
else if(b*b-4*a*c=0){
|
36
|
+
|
37
|
+
d=-b/(2*a);
|
38
|
+
|
39
|
+
printf("実数解は%f(重解)です",d);
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
else {
|
44
|
+
|
7
|
-
|
45
|
+
printf("実数解はありません");
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
return 0;
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
#fと置いた後
|
8
54
|
|
9
55
|
int main(void) {
|
10
56
|
|
@@ -27,8 +73,6 @@
|
|
27
73
|
f = (double)b*b-4*a*c;
|
28
74
|
|
29
75
|
if(f>0){
|
30
|
-
|
31
|
-
//fと置かずにやるとエラーが起こった。何故なのか?
|
32
76
|
|
33
77
|
d=((double)-b+sqrt(f))/(2*a);
|
34
78
|
|