質問編集履歴
1
エラー文の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,84 @@
|
|
1
1
|
C言語でキーボードから20個の点のx、y座標を配列pに入力させるプログラム
|
2
|
-
のコンパイルがエラーになってしまいます。色々な書き方をしてみたのですが点の入力のコードが間違っているのかその他でエラーになっているのかが分からななく手詰まり状態という感じです。
|
2
|
+
のコンパイルがエラーになってしまいます。色々な書き方をしてみたのですが点の入力のコードが間違っているのかその他でエラーになっているのかが分からななく手詰まり状態という感じです。エラーの書き忘れ申し訳ないです。
|
3
|
+
|
4
|
+
Main.c:14:8: error: assigning to 'int' from incompatible type 'struct point'
|
5
|
+
pivot =p[somewhere];
|
6
|
+
^~~~~~~~~~~~~
|
7
|
+
Main.c:16:16: error: invalid operands to binary expression ('struct point' and 'int')
|
8
|
+
do{ while(p[i]<pivot)i++;
|
9
|
+
~~~~^~~~~~
|
10
|
+
Main.c:17:16: error: invalid operands to binary expression ('struct point' and 'int')
|
11
|
+
while(p[j]>pivot)j--;
|
12
|
+
~~~~^~~~~~
|
13
|
+
Main.c:19:13: error: assigning to 'int' from incompatible type 'struct point'
|
14
|
+
{ temp = p[i];p[i] =p[j];p[j] =temp;
|
15
|
+
^ ~~~~
|
16
|
+
Main.c:19:36: error: assigning to 'struct point' from incompatible type 'int'
|
17
|
+
{ temp = p[i];p[i] =p[j];p[j] =temp;
|
18
|
+
^~~~~
|
19
|
+
Main.c:24:21: error: member reference base type 'int' is not a structure or union
|
20
|
+
quicksort(first.j);/*pivotより小さなデータについてquicksort()を行う*/
|
21
|
+
~~~~~^~
|
22
|
+
Main.c:39:17: error: use of undeclared identifier 'n'
|
23
|
+
for (i =1;i<n;i+ +)
|
24
|
+
^
|
25
|
+
Main.c:39:23: error: expected expression
|
26
|
+
for (i =1;i<n;i+ +)
|
27
|
+
^
|
28
|
+
Main.c:40:46: warning: '&&' within '||' [-Wlogical-op-parentheses]
|
29
|
+
if(p[i].y<p[min].y ||p[i].y==p[min].y&&p[i].x>p[min].x)
|
30
|
+
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
|
31
|
+
Main.c:40:46: note: place parentheses around the '&&' expression to silence this warning
|
32
|
+
if(p[i].y<p[min].y ||p[i].y==p[min].y&&p[i].x>p[min].x)
|
33
|
+
^
|
34
|
+
( )
|
35
|
+
Main.c:42:22: error: expected expression
|
36
|
+
temp =p[0];p[0] =[min];p[min] =temp;/*関数area()を使って1番目以降の点を偏角順にソート*/
|
37
|
+
^
|
38
|
+
Main.c:44:16: error: use of undeclared identifier 'n'
|
39
|
+
for(i =2;i<n;i++)
|
40
|
+
^
|
41
|
+
Main.c:45:27: error: no member named 'p' in 'struct point'
|
42
|
+
{while (area(p[top-1].p[top].p[i])<= 0)
|
43
|
+
~~~~~~~~ ^
|
44
|
+
Main.c:47:11: warning: misleading indentation; statement is not part of the previous 'while' [-Wmisleading-indentation]
|
45
|
+
temp [top];p[top] =p[i];p[i]=temp;
|
46
|
+
^
|
47
|
+
Main.c:45:6: note: previous statement is here
|
48
|
+
{while (area(p[top-1].p[top].p[i])<= 0)
|
49
|
+
^
|
50
|
+
Main.c:47:16: error: subscripted value is not an array, pointer, or vector
|
51
|
+
temp [top];p[top] =p[i];p[i]=temp;
|
52
|
+
~~~~ ^~~~
|
53
|
+
Main.c:54:1: error: unknown type name 'Void'; did you mean 'void'?
|
54
|
+
Void main(void)
|
55
|
+
^~~~
|
56
|
+
void
|
57
|
+
Main.c:54:1: error: 'main' must return 'int'
|
58
|
+
Void main(void)
|
59
|
+
^~~~
|
60
|
+
int
|
61
|
+
Main.c:58:47: error: expected expression
|
62
|
+
printf("p[%d].y=",i); scanf("%d",&p[i].y);)
|
63
|
+
^
|
64
|
+
Main.c:62:2: error: expected '}'
|
65
|
+
}
|
66
|
+
^
|
67
|
+
Main.c:55:1: note: to match this '{'
|
68
|
+
{
|
69
|
+
^
|
70
|
+
2 warnings and 16 errors generated.
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
3
82
|
```C
|
4
83
|
#include<stdio.h>
|
5
84
|
#include<math.h>
|