回答編集履歴

3

再々々修正

2018/01/15 04:35

投稿

ttyp03
ttyp03

スコア16998

test CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
  while(fscanf(fp, "%[^,],%[^,],%d,%d\n", date, month, &num1, &num2) != EOF) {
50
50
 
51
- printf("%s,%s,%d,%d", date, month, num1, num2);
51
+ printf("%s,%s,%d,%d\n", date, month, num1, num2);
52
52
 
53
53
  }
54
54
 

2

再々修正

2018/01/15 04:35

投稿

ttyp03
ttyp03

スコア16998

test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
 
48
48
 
49
- while(fscanf(fp, "%[^,],%[^,],%d,%d", date, month, &num1, &num2) != EOF) {
49
+ while(fscanf(fp, "%[^,],%[^,],%d,%d\n", date, month, &num1, &num2) != EOF) {
50
50
 
51
51
  printf("%s,%s,%d,%d", date, month, num1, num2);
52
52
 

1

sscanf書式修正

2018/01/15 04:35

投稿

ttyp03
ttyp03

スコア16998

test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
 
48
48
 
49
- while(fscanf(fp, "%s,%s,%d,%d", date, month, &num1, &num2) != EOF) {
49
+ while(fscanf(fp, "%[^,],%[^,],%d,%d", date, month, &num1, &num2) != EOF) {
50
50
 
51
51
  printf("%s,%s,%d,%d", date, month, num1, num2);
52
52