teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

修正

2018/07/09 04:44

投稿

forza
forza

スコア21

title CHANGED
File without changes
body CHANGED
@@ -22,9 +22,9 @@
22
22
  printf("出力ファイルなし\n");
23
23
  exit(1);
24
24
  }
25
- for (i = 0; str[i]!=0; i++)
25
+ for (i = 0; i<200; i++)
26
26
  {
27
- for (j = 0; str[j]!=0; j++)
27
+ for (j = 0; i<200-i; j++)
28
28
  {
29
29
  fscanf(fin, "%c", &str[i]);
30
30
  if(str[i]>str[j])

2

プログラム修正

2018/07/09 04:44

投稿

forza
forza

スコア21

title CHANGED
File without changes
body CHANGED
@@ -24,7 +24,7 @@
24
24
  }
25
25
  for (i = 0; str[i]!=0; i++)
26
26
  {
27
- for (j = i+1; str[j]!=0; j++)
27
+ for (j = 0; str[j]!=0; j++)
28
28
  {
29
29
  fscanf(fin, "%c", &str[i]);
30
30
  if(str[i]>str[j])

1

プログラムの変更

2018/07/09 04:13

投稿

forza
forza

スコア21

title CHANGED
File without changes
body CHANGED
@@ -26,14 +26,14 @@
26
26
  {
27
27
  for (j = i+1; str[j]!=0; j++)
28
28
  {
29
- fscanf(fin, "%s", &str[i]);
29
+ fscanf(fin, "%c", &str[i]);
30
30
  if(str[i]>str[j])
31
31
  {
32
32
  a=str[i];
33
33
  str[i]=str[j];
34
34
  str[j]=a;
35
35
  }
36
- fprintf(fout,"%s",&str[i]);
36
+ fprintf(fout,"%c",&str[i]);
37
37
  }
38
38
  fclose(fin);
39
39
  fclose(fout);