質問編集履歴
4
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,21 +52,39 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
+
|
56
|
+
|
57
|
+
修正
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
下記が書き直したコードです。
|
62
|
+
|
55
|
-
|
63
|
+
```ここに言語を入力
|
64
|
+
|
65
|
+
#define _CRT_SECURE_NO_WARNINGS
|
66
|
+
|
67
|
+
#include <stdio.h>
|
68
|
+
|
69
|
+
#include <string.h>
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
56
74
|
|
57
75
|
struct employee
|
58
76
|
|
59
77
|
{
|
60
78
|
|
61
|
-
|
79
|
+
char name[50];
|
62
|
-
|
80
|
+
|
63
|
-
|
81
|
+
char id[6];
|
64
|
-
|
82
|
+
|
65
|
-
|
83
|
+
char tel[15];
|
66
|
-
|
84
|
+
|
67
|
-
|
85
|
+
char department[30];
|
68
|
-
|
86
|
+
|
69
|
-
|
87
|
+
char line[30];
|
70
88
|
|
71
89
|
|
72
90
|
|
@@ -76,182 +94,228 @@
|
|
76
94
|
|
77
95
|
|
78
96
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
97
|
+
int main()
|
98
|
+
|
99
|
+
{
|
100
|
+
|
101
|
+
FILE* fp;
|
102
|
+
|
103
|
+
int c;
|
104
|
+
|
105
|
+
int cnt = 0;
|
106
|
+
|
107
|
+
int count;
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
int mt;
|
112
|
+
|
113
|
+
char str[100];
|
114
|
+
|
115
|
+
fp = fopen("tel.txt", "r");
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
while ((c = getc(fp)) != EOF)
|
120
|
+
|
121
|
+
{
|
122
|
+
|
123
|
+
if (c == '\n') cnt++;
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
count = cnt / 5;
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
rewind(fp);
|
134
|
+
|
135
|
+
struct employee S1[100];
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
while (fgets(str, sizeof(str), fp) != NULL)
|
140
|
+
|
141
|
+
{
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
for (int i = 0; i < count; i++)
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
fgets(str, sizeof(str), fp);
|
150
|
+
|
151
|
+
sscanf(str, "%*[^:]:%s", S1[i].name);
|
152
|
+
|
153
|
+
printf("NAME%s\n", S1[i].name);
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
fgets(str, sizeof(str), fp);
|
158
|
+
|
159
|
+
sscanf(str, "%*[^:]:%5s", S1[i].id);
|
160
|
+
|
161
|
+
printf("ID%s\n", S1[i].id);
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
fgets(str, sizeof(str), fp);
|
166
|
+
|
167
|
+
sscanf(str, "%*[^:]:%s", S1[i].tel);
|
168
|
+
|
169
|
+
printf("TEL%s\n", S1[i].tel);
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
fgets(str, sizeof(str), fp);
|
174
|
+
|
175
|
+
sscanf(str, "%*[^:]:%s", S1[i].department);
|
176
|
+
|
177
|
+
printf("DEP%s\n", S1[i].department);
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
fgets(str, sizeof(str), fp);
|
182
|
+
|
183
|
+
sscanf(str, "%s", S1[i].line);
|
184
|
+
|
185
|
+
printf("%s\n", S1[i].line);
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
fclose(fp);
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
|
186
204
|
|
187
205
|
```
|
188
206
|
|
189
|
-
修正
|
190
|
-
|
191
207
|
```ここに言語を入力
|
192
208
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
209
|
+
|
210
|
+
|
211
|
+
```出力
|
212
|
+
|
213
|
+
```ここに言語を入
|
214
|
+
|
215
|
+
NAMEID02
|
216
|
+
|
217
|
+
ID090xx
|
218
|
+
|
219
|
+
TELb
|
220
|
+
|
221
|
+
DEPフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフ=======================
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
NAME:ddd
|
226
|
+
|
227
|
+
NAMEID04
|
228
|
+
|
229
|
+
ID090xx
|
230
|
+
|
231
|
+
TELa
|
232
|
+
|
233
|
+
DEPフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフ=======================
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
NAME:ccc
|
238
|
+
|
239
|
+
NAMEID03
|
240
|
+
|
241
|
+
ID12345
|
242
|
+
|
243
|
+
TELa
|
244
|
+
|
245
|
+
DEPフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフ=======================
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
NAME:aaa
|
250
|
+
|
251
|
+
NAMEID01
|
252
|
+
|
253
|
+
ID12345
|
254
|
+
|
255
|
+
TELa
|
256
|
+
|
257
|
+
DEPフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフフ=======================
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
=======================
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
C:\Users\pokki\source\repos\Project1\Debug\Project1.exe (process 13808) exited with code 0.
|
266
|
+
|
267
|
+
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
|
268
|
+
|
269
|
+
Press any key to close this window . . .
|
270
|
+
|
271
|
+
|
248
272
|
|
249
273
|
```
|
250
274
|
|
275
|
+
期待する出力
|
276
|
+
|
277
|
+
```期待する出力
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
NAME:bbb
|
282
|
+
|
283
|
+
ID:ID02
|
284
|
+
|
285
|
+
TEL:090xxxxxxxx
|
286
|
+
|
287
|
+
DEP:b
|
288
|
+
|
289
|
+
=======================
|
290
|
+
|
291
|
+
NAME:ddd
|
292
|
+
|
293
|
+
ID:ID04
|
294
|
+
|
295
|
+
TEL:090xxxxxxxx
|
296
|
+
|
297
|
+
DEP:a
|
298
|
+
|
299
|
+
=======================
|
300
|
+
|
301
|
+
NAME:ccc
|
302
|
+
|
303
|
+
ID:ID03
|
304
|
+
|
305
|
+
TEL:123456789
|
306
|
+
|
307
|
+
DEP:b
|
308
|
+
|
309
|
+
=======================
|
310
|
+
|
311
|
+
NAME:aaa
|
312
|
+
|
313
|
+
ID:ID01
|
314
|
+
|
315
|
+
TEL:12345678
|
316
|
+
|
317
|
+
DEP:a
|
318
|
+
|
319
|
+
=======================
|
320
|
+
|
251
321
|
```
|
252
|
-
|
253
|
-
```
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
```
|
3
かきかえ
test
CHANGED
File without changes
|
test
CHANGED
@@ -186,6 +186,72 @@
|
|
186
186
|
|
187
187
|
```
|
188
188
|
|
189
|
-
|
189
|
+
修正
|
190
|
+
|
190
|
-
|
191
|
+
```ここに言語を入力
|
192
|
+
|
193
|
+
rewind(fp);
|
194
|
+
|
195
|
+
struct employee S1[100];
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
while (fgets(str, sizeof(str), fp) != NULL)
|
200
|
+
|
201
|
+
{
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
for (int i = 0; i < count; i++)
|
206
|
+
|
207
|
+
{
|
208
|
+
|
209
|
+
fgets(str, sizeof(str), fp);
|
210
|
+
|
211
|
+
sscanf(str, "%*[^:]%s", S1[i].name);
|
212
|
+
|
213
|
+
printf("%s", S1[i].name);
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
fgets(str, sizeof(str), fp);
|
218
|
+
|
219
|
+
sscanf(str, "%*[^:]%s", S1[i].id);
|
220
|
+
|
221
|
+
printf("%s", S1[i].id);
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
fgets(str, sizeof(str), fp);
|
226
|
+
|
227
|
+
sscanf(str, "%*[^:]%s", S1[i].tel);
|
228
|
+
|
229
|
+
printf("%s", S1[i].tel);
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
fgets(str, sizeof(str), fp);
|
234
|
+
|
235
|
+
sscanf(str, "%*[^:]%s", S1[i].department);
|
236
|
+
|
237
|
+
printf("%s", S1[i].department);
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
fgets(str, sizeof(str), fp);
|
242
|
+
|
243
|
+
sscanf(str, "%*[^:]%s", S1[i].line);
|
244
|
+
|
245
|
+
printf("%s", S1[i].line);
|
246
|
+
|
247
|
+
}
|
248
|
+
|
191
|
-
```
|
249
|
+
```
|
250
|
+
|
251
|
+
```
|
252
|
+
|
253
|
+
```
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
```
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
> 縦に情報がはいっているテキストファイルを構造体配列に読み込みんだ後この情報をリンクドリストやアレイを使いDEPの部門ごとにソートたいです。===までが一人の情報です。ファイルNAMEからDEPをまでを一つの構造体にいれるとこまでやってみたんですがうまくいきません。===はなくてもあってもどちらでも大丈夫です。
|
2
2
|
|
3
|
-
そのあと、DEPが同じ部門(部門がaならその部門を続けて)を連ねてソートしたいのですがそちらのサンプルアンサーやアドバイスもよろしくお願いします。(自分でも考えてはいるのですが初心者なものでなかなか難しいです)
|
3
|
+
そのあと、リンクドリストやアレイを使いDEPが同じ部門(部門がaならその部門を続けて)を連ねてソートしたいのですがそちらのサンプルアンサーやアドバイスもよろしくお願いします。(自分でも考えてはいるのですが初心者なものでなかなか難しいです)
|
4
4
|
|
5
5
|
```ここに言語を入力
|
6
6
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
> 縦に情報がはいっているテキストファイル
|
1
|
+
> 縦に情報がはいっているテキストファイルを構造体配列に読み込みんだ後この情報をリンクドリストやアレイを使いDEPの部門ごとにソートたいです。===までが一人の情報です。ファイルNAMEからDEPをまでを一つの構造体にいれるとこまでやってみたんですがうまくいきません。===はなくてもあってもどちらでも大丈夫です。
|
2
2
|
|
3
3
|
そのあと、DEPが同じ部門(部門がaならその部門を続けて)を連ねてソートしたいのですがそちらのサンプルアンサーやアドバイスもよろしくお願いします。(自分でも考えてはいるのですが初心者なものでなかなか難しいです)
|
4
4
|
|