質問編集履歴

7

エラーが減りました。

2016/08/05 10:22

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -30,9 +30,25 @@
30
30
 
31
31
  {
32
32
 
33
- student data[] = { 1,2,3,"A",12.3,45.6};
33
+ student data[] = {
34
34
 
35
+ { 1,2,3,"A",12.3,45.6}
36
+
37
+ , { 1,2,4,"B",12.3,45.6}
38
+
39
+ , { 1,2,5,"C",12.3,45.6}
40
+
41
+ , { 1,2,6,"D",12.3,45.6}
42
+
43
+ , { 1,2,7,"E",12.3,45.6}
44
+
45
+ , { 1,2,8,"F",12.3,45.6}
46
+
47
+ , { 1,2,9,"G",12.3,45.6}
48
+
49
+ };
50
+
35
- student_print(student data[],int 7);
51
+ student_print(data, 7);
36
52
 
37
53
  return;
38
54
 
@@ -72,17 +88,11 @@
72
88
 
73
89
  prog.cc: In function 'int main()':
74
90
 
75
- prog.cc:18:27: error: expected primary-expression before 'data'
91
+ prog.cc:27:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
76
92
 
77
- student_print(student data[],int 7);
93
+ return;
78
94
 
79
- ^~~~
95
+ ^~~~~~
80
-
81
- prog.cc:18:34: error: expected primary-expression before 'int'
82
-
83
- student_print(student data[],int 7);
84
-
85
- ^~~
86
96
 
87
97
 
88
98
 

6

全角をすべて半角にしました。

2016/08/05 10:22

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -6,17 +6,17 @@
6
6
 
7
7
  struct student {
8
8
 
9
- int year; /* 学年 */
9
+ int year; /* 学年 */
10
10
 
11
- int clas; /* クラス */
11
+ int clas; /* クラス */
12
12
 
13
- int number; /* 出席番号 */
13
+ int number; /* 出席番号 */
14
14
 
15
- char name[64]; /* 名前 */
15
+ char name[64]; /* 名前 */
16
16
 
17
- double stature; /* 身長 */
17
+ double stature;/* 身長 */
18
18
 
19
- double weight; /* 体重 */
19
+ double weight; /* 体重 */
20
20
 
21
21
  };
22
22
 
@@ -70,11 +70,19 @@
70
70
 
71
71
  エラーメッセジが次のようにでます。
72
72
 
73
- prog.cc:27:46: error: stray '\343' in program
73
+ prog.cc: In function 'int main()':
74
74
 
75
- printf("[クラス]:%d\n",data[i].clas);
75
+ prog.cc:18:27: error: expected primary-expression before 'data'
76
76
 
77
+ student_print(student data[],int 7);
78
+
79
+ ^~~~
80
+
81
+ prog.cc:18:34: error: expected primary-expression before 'int'
82
+
83
+ student_print(student data[],int 7);
84
+
77
- ^
85
+ ^~~
78
86
 
79
87
 
80
88
 

5

コードブロックで囲んでみました。

2016/08/05 10:16

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- #include <stdio.h>
1
+ ```#include <stdio.h>
2
2
 
3
3
  #include <string.h>
4
4
 
@@ -66,7 +66,7 @@
66
66
 
67
67
  }
68
68
 
69
-
69
+ ```
70
70
 
71
71
  エラーメッセジが次のようにでます。
72
72
 

4

printfの末尾にある全角を取り除きました。

2016/08/05 10:08

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,13 +44,13 @@
44
44
 
45
45
  {
46
46
 
47
- int i;
47
+ int i;
48
48
 
49
- for (i = 0;i < count;i++) {
49
+ for (i = 0;i < count;i++) {
50
50
 
51
51
  printf("[学年]:%d\n",data[i].year);
52
52
 
53
- printf("[クラス]:%d\n",data[i].clas);
53
+ printf("[クラス]:%d\n",data[i].clas);
54
54
 
55
55
  printf("[出席番号]:%d\n",data[i].number);
56
56
 
@@ -60,13 +60,11 @@
60
60
 
61
61
  printf("[体重]:%f\n",data[i].weight);
62
62
 
63
- }
63
+ }
64
64
 
65
- return;
65
+ return;
66
66
 
67
67
  }
68
-
69
-
70
68
 
71
69
 
72
70
 

3

エラーメッセージが減りました。

2016/08/05 09:59

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,9 @@
32
32
 
33
33
  student data[] = { 1,2,3,"A",12.3,45.6};
34
34
 
35
- student_print(student data[],int 6);
35
+ student_print(student data[],int 7);
36
+
37
+ return;
36
38
 
37
39
  }
38
40
 
@@ -70,39 +72,11 @@
70
72
 
71
73
  エラーメッセジが次のようにでます。
72
74
 
73
- prog.cc:26:46: error: stray '\343' in program
75
+ prog.cc:27:46: error: stray '\343' in program
74
76
 
75
77
  printf("[クラス]:%d\n",data[i].clas);
76
78
 
77
79
  ^
78
-
79
- prog.cc:26:47: error: stray '\200' in program
80
-
81
- printf("[クラス]:%d\n",data[i].clas);
82
-
83
- ^
84
-
85
- prog.cc:26:48: error: stray '\200' in program
86
-
87
- printf("[クラス]:%d\n",data[i].clas);
88
-
89
- ^
90
-
91
- prog.cc:26:49: error: stray '\343' in program
92
-
93
- printf("[クラス]:%d\n",data[i].clas);
94
-
95
- ^
96
-
97
- prog.cc:26:50: error: stray '\200' in program
98
-
99
- printf("[クラス]:%d\n",data[i].clas);
100
-
101
- ^
102
-
103
- prog.cc:26:51: error: stray '\200' in program
104
-
105
- printf("[クラス]:%d\n",data[i].clas);
106
80
 
107
81
 
108
82
 

2

エラーメッセージを更新しました。

2016/08/05 09:48

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  student data[] = { 1,2,3,"A",12.3,45.6};
34
34
 
35
- student_print(student data[],int 7);
35
+ student_print(student data[],int 6);
36
36
 
37
37
  }
38
38
 
@@ -70,41 +70,39 @@
70
70
 
71
71
  エラーメッセジが次のようにでます。
72
72
 
73
- prog.cc:26:43: error: stray '\343' in program
74
-
75
- printf("[クラス]:%d\n",data[i].clas);
76
-
77
- ^
78
-
79
- prog.cc:26:44: error: stray '\200' in program
80
-
81
- printf("[クラス]:%d\n",data[i].clas);
82
-
83
- ^
84
-
85
- prog.cc:26:45: error: stray '\200' in program
86
-
87
- printf("[クラス]:%d\n",data[i].clas);
88
-
89
- ^
90
-
91
73
  prog.cc:26:46: error: stray '\343' in program
92
74
 
93
- printf("[クラス]:%d\n",data[i].clas);
75
+ printf("[クラス]:%d\n",data[i].clas);
94
76
 
95
77
  ^
96
78
 
97
79
  prog.cc:26:47: error: stray '\200' in program
98
80
 
99
- printf("[クラス]:%d\n",data[i].clas);
81
+ printf("[クラス]:%d\n",data[i].clas);
100
82
 
101
83
  ^
102
84
 
103
85
  prog.cc:26:48: error: stray '\200' in program
104
86
 
105
- printf("[クラス]:%d\n",data[i].clas);
87
+ printf("[クラス]:%d\n",data[i].clas);
106
88
 
107
89
  ^
90
+
91
+ prog.cc:26:49: error: stray '\343' in program
92
+
93
+ printf("[クラス]:%d\n",data[i].clas);
94
+
95
+ ^
96
+
97
+ prog.cc:26:50: error: stray '\200' in program
98
+
99
+ printf("[クラス]:%d\n",data[i].clas);
100
+
101
+ ^
102
+
103
+ prog.cc:26:51: error: stray '\200' in program
104
+
105
+ printf("[クラス]:%d\n",data[i].clas);
108
106
 
109
107
 
110
108
 

1

Printfの前の全角を半角へ変更しました。

2016/08/05 09:41

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -30,9 +30,9 @@
30
30
 
31
31
  {
32
32
 
33
- student data[] = { 1,2,,3,"",12.3,45.6};
33
+ student data[] = { 1,2,3,"A",12.3,45.6};
34
34
 
35
- student_print(student data[],int 6);
35
+ student_print(student data[],int 7);
36
36
 
37
37
  }
38
38
 
@@ -46,17 +46,17 @@
46
46
 
47
47
  for (i = 0;i < count;i++) {
48
48
 
49
- printf("[学年]:%d\n",data[i].year);
49
+ printf("[学年]:%d\n",data[i].year);
50
50
 
51
- printf("[クラス]:%d\n",data[i].clas);
51
+ printf("[クラス]:%d\n",data[i].clas);
52
52
 
53
- printf("[出席番号]:%d\n",data[i].number);
53
+ printf("[出席番号]:%d\n",data[i].number);
54
54
 
55
- printf("[名前]:%s\n",data[i].name);
55
+ printf("[名前]:%s\n",data[i].name);
56
56
 
57
- printf("[身長]:%f\n",data[i].stature);
57
+ printf("[身長]:%f\n",data[i].stature);
58
58
 
59
- printf("[体重]:%f\n",data[i].weight);
59
+ printf("[体重]:%f\n",data[i].weight);
60
60
 
61
61
  }
62
62