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

回答編集履歴

2

変更

2017/08/19 03:24

投稿

A.Ichi
A.Ichi

スコア4070

answer CHANGED
File without changes

1

変更

2017/08/19 03:24

投稿

A.Ichi
A.Ichi

スコア4070

answer CHANGED
@@ -26,17 +26,9 @@
26
26
  length3 = strlen(l);
27
27
 
28
28
  /*3つの文字列の長さを比較したい*/
29
- if (length > length2){
30
- if (length > length3){
31
- lenmax = length;
29
+ lenmax = length;
32
- } else {
33
- lenmax = length3;
34
- }
35
- }else if (length2 > length3){
30
+ if (lenmax < length2) lenmax = length2;
36
- lenmax = length2;
37
- } else {
38
- lenmax = length3;
31
+ if (lenmax < length3) lenmax = length3;
39
- }
40
32
 
41
33
  printf("もっとも長い文字列:\n");
42
34
  if ( lenmax == length ) printf("%s\n",n);