質問編集履歴
1
エラー文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,164 @@
|
|
1
1
|
C言語でキーボードから20個の点のx、y座標を配列pに入力させるプログラム
|
2
2
|
|
3
|
-
のコンパイルがエラーになってしまいます。色々な書き方をしてみたのですが点の入力のコードが間違っているのかその他でエラーになっているのかが分からななく手詰まり状態という感じです。
|
3
|
+
のコンパイルがエラーになってしまいます。色々な書き方をしてみたのですが点の入力のコードが間違っているのかその他でエラーになっているのかが分からななく手詰まり状態という感じです。エラーの書き忘れ申し訳ないです。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
Main.c:14:8: error: assigning to 'int' from incompatible type 'struct point'
|
8
|
+
|
9
|
+
pivot =p[somewhere];
|
10
|
+
|
11
|
+
^~~~~~~~~~~~~
|
12
|
+
|
13
|
+
Main.c:16:16: error: invalid operands to binary expression ('struct point' and 'int')
|
14
|
+
|
15
|
+
do{ while(p[i]<pivot)i++;
|
16
|
+
|
17
|
+
~~~~^~~~~~
|
18
|
+
|
19
|
+
Main.c:17:16: error: invalid operands to binary expression ('struct point' and 'int')
|
20
|
+
|
21
|
+
while(p[j]>pivot)j--;
|
22
|
+
|
23
|
+
~~~~^~~~~~
|
24
|
+
|
25
|
+
Main.c:19:13: error: assigning to 'int' from incompatible type 'struct point'
|
26
|
+
|
27
|
+
{ temp = p[i];p[i] =p[j];p[j] =temp;
|
28
|
+
|
29
|
+
^ ~~~~
|
30
|
+
|
31
|
+
Main.c:19:36: error: assigning to 'struct point' from incompatible type 'int'
|
32
|
+
|
33
|
+
{ temp = p[i];p[i] =p[j];p[j] =temp;
|
34
|
+
|
35
|
+
^~~~~
|
36
|
+
|
37
|
+
Main.c:24:21: error: member reference base type 'int' is not a structure or union
|
38
|
+
|
39
|
+
quicksort(first.j);/*pivotより小さなデータについてquicksort()を行う*/
|
40
|
+
|
41
|
+
~~~~~^~
|
42
|
+
|
43
|
+
Main.c:39:17: error: use of undeclared identifier 'n'
|
44
|
+
|
45
|
+
for (i =1;i<n;i+ +)
|
46
|
+
|
47
|
+
^
|
48
|
+
|
49
|
+
Main.c:39:23: error: expected expression
|
50
|
+
|
51
|
+
for (i =1;i<n;i+ +)
|
52
|
+
|
53
|
+
^
|
54
|
+
|
55
|
+
Main.c:40:46: warning: '&&' within '||' [-Wlogical-op-parentheses]
|
56
|
+
|
57
|
+
if(p[i].y<p[min].y ||p[i].y==p[min].y&&p[i].x>p[min].x)
|
58
|
+
|
59
|
+
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
|
60
|
+
|
61
|
+
Main.c:40:46: note: place parentheses around the '&&' expression to silence this warning
|
62
|
+
|
63
|
+
if(p[i].y<p[min].y ||p[i].y==p[min].y&&p[i].x>p[min].x)
|
64
|
+
|
65
|
+
^
|
66
|
+
|
67
|
+
( )
|
68
|
+
|
69
|
+
Main.c:42:22: error: expected expression
|
70
|
+
|
71
|
+
temp =p[0];p[0] =[min];p[min] =temp;/*関数area()を使って1番目以降の点を偏角順にソート*/
|
72
|
+
|
73
|
+
^
|
74
|
+
|
75
|
+
Main.c:44:16: error: use of undeclared identifier 'n'
|
76
|
+
|
77
|
+
for(i =2;i<n;i++)
|
78
|
+
|
79
|
+
^
|
80
|
+
|
81
|
+
Main.c:45:27: error: no member named 'p' in 'struct point'
|
82
|
+
|
83
|
+
{while (area(p[top-1].p[top].p[i])<= 0)
|
84
|
+
|
85
|
+
~~~~~~~~ ^
|
86
|
+
|
87
|
+
Main.c:47:11: warning: misleading indentation; statement is not part of the previous 'while' [-Wmisleading-indentation]
|
88
|
+
|
89
|
+
temp [top];p[top] =p[i];p[i]=temp;
|
90
|
+
|
91
|
+
^
|
92
|
+
|
93
|
+
Main.c:45:6: note: previous statement is here
|
94
|
+
|
95
|
+
{while (area(p[top-1].p[top].p[i])<= 0)
|
96
|
+
|
97
|
+
^
|
98
|
+
|
99
|
+
Main.c:47:16: error: subscripted value is not an array, pointer, or vector
|
100
|
+
|
101
|
+
temp [top];p[top] =p[i];p[i]=temp;
|
102
|
+
|
103
|
+
~~~~ ^~~~
|
104
|
+
|
105
|
+
Main.c:54:1: error: unknown type name 'Void'; did you mean 'void'?
|
106
|
+
|
107
|
+
Void main(void)
|
108
|
+
|
109
|
+
^~~~
|
110
|
+
|
111
|
+
void
|
112
|
+
|
113
|
+
Main.c:54:1: error: 'main' must return 'int'
|
114
|
+
|
115
|
+
Void main(void)
|
116
|
+
|
117
|
+
^~~~
|
118
|
+
|
119
|
+
int
|
120
|
+
|
121
|
+
Main.c:58:47: error: expected expression
|
122
|
+
|
123
|
+
printf("p[%d].y=",i); scanf("%d",&p[i].y);)
|
124
|
+
|
125
|
+
^
|
126
|
+
|
127
|
+
Main.c:62:2: error: expected '}'
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
^
|
132
|
+
|
133
|
+
Main.c:55:1: note: to match this '{'
|
134
|
+
|
135
|
+
{
|
136
|
+
|
137
|
+
^
|
138
|
+
|
139
|
+
2 warnings and 16 errors generated.
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
4
162
|
|
5
163
|
```C
|
6
164
|
|