修改文件结构。
This commit is contained in:
42
POP/05/Exercise01.c
Normal file
42
POP/05/Exercise01.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void decideShape(int max, int small_1, int small_2) {
|
||||
if (small_1 + small_2 > max) {
|
||||
if (small_1 == small_2) {
|
||||
if (small_1 == max) {
|
||||
printf("Equilateral triangle");
|
||||
}
|
||||
else {
|
||||
printf("Isosceles triangle");
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("Triangle");
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("Not a triangle");
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int a = 0, b = 0, c = 0;
|
||||
scanf("%d %d %d", &a, &b, &c);
|
||||
if (a > c) {
|
||||
if (a > b) {
|
||||
decideShape(a, b, c);
|
||||
}
|
||||
else {
|
||||
decideShape(b, a, c);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (c > b) {
|
||||
decideShape(c, a, b);
|
||||
}
|
||||
else {
|
||||
decideShape(b, a, c);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user