From 8cd93716389564ee4b59a0ccca6887acb8f9b186 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Thu, 23 Jun 2011 20:47:30 +0900 Subject: [PATCH] =?utf8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=83=97?= =?utf8?q?=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0=E3=81=AE=E8=BF=94=E3=82=8A?= =?utf8?q?=E5=80=A4=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sample/triangle/triangle.c | 8 ++++---- sample/triangle/triangle_bug.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sample/triangle/triangle.c b/sample/triangle/triangle.c index 3899e27..057780d 100644 --- a/sample/triangle/triangle.c +++ b/sample/triangle/triangle.c @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) else if(argc > 4) { fprintf(stderr, "too many argument.\n"); } - return -1; + return 1; } for(i = 0; i < 3; i++) { /* 引数を整数に変換 */ @@ -35,18 +35,18 @@ int main(int argc, char *argv[]) /* 整数以外の場合はエラー終了 */ if(*check != '\0') { fprintf(stderr, "%s: not integer\n", argv[i+1]); - return -1; + return 1; } /* 0未満の場合はエラー終了 */ if(l[i] < 0) { fprintf(stderr, "%s: less than zero\n", argv[i+1]); - return -1; + return 1; } } /* 三角不等式により、三角形になるかを判定 */ if(l[0] + l[1] <= l[2] || l[1] + l[2] <= l[0] || l[2] + l[0] <= l[1]) { puts("not triangle"); - return -1; + return 1; } /* 3辺の長さが等しい場合は、正三角形 */ if(l[0] == l[1] && l[1] == l[2] && l[2] == l[0]) { diff --git a/sample/triangle/triangle_bug.c b/sample/triangle/triangle_bug.c index 91403fd..263f6e4 100644 --- a/sample/triangle/triangle_bug.c +++ b/sample/triangle/triangle_bug.c @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) else if(argc > 4) { fprintf(stderr, "too many argument.\n"); } - return -1; + return 1; } for(i = 0; i < 3; i++) { /* 引数を整数に変換 */ @@ -35,12 +35,12 @@ int main(int argc, char *argv[]) /* 整数以外の場合はエラー終了 */ if(*check != '\0') { fprintf(stderr, "%s: not integer\n", argv[i+1]); - return -1; + return 1; } /* 0未満の場合はエラー終了 */ if(l[i] < 0) { fprintf(stderr, "%s: less than zero\n", argv[i+1]); - return -1; + return 1; } } /* 3辺の長さが等しい場合は、正三角形 */ @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) /* 三角不等式により、三角形になるかを判定 */ if(l[0] + l[1] <= l[2] || l[1] + l[2] <= l[0] || l[2] + l[0] <= l[1]) { puts("not triangle"); - return -1; + return 1; } /* 2辺の長さが等しい場合は、二等辺三角形 */ if (l[0] == l[1] || l[1] == l[2] || l[2] == l[0]) { -- 2.18.0