-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRodzaje trójkątów.cpp
69 lines (65 loc) · 1.65 KB
/
Rodzaje trójkątów.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
double x,y,z;
while (cin >> x >> y >> z) {
int tab[] = {x, y, z};
sort(tab, tab+3);
if (tab[0] + tab[1] <= tab[2])
{
cout<<"brak\n";
}
else if(tab[0] * tab[0] + tab[1] * tab[1] == tab[2] * tab[2] )
{
cout<<"prostokatny\n";
}
else if(tab[0] * tab[0] + tab[1] * tab[1] > tab[2] * tab[2] )
{
cout<<"ostrokatny\n";
}
else
{
cout<<"rozwartokatny\n";
}
}
}
// WSZYSTKIE TESTY PRZECHODZA, SEDZIA NIE PRZYJMUJE
/*
int main()
{
double bok[3];
while (cin>>bok[0]>>bok[1]>>bok[2])
{
bubbleSort (bok, 3);
if ((bok[0] + bok[1] > bok[2]) && (bok[1] + bok[2] > bok[0]) &&(bok[0] + bok[2] > bok[1])&&(bok[1])> 0 &&(bok [2])> 0 &&(bok[3])> 0)
{
if (bok[0]*bok[0] + bok[1]*bok[1] == bok[2]*bok[2]) {cout<<"prostokatny\n";}
if (bok[0]*bok[0] + bok[1]*bok[1] > bok[2]*bok[2]) {cout<<"ostrokatny\n";}
if (bok[0]*bok[0] + bok[1]*bok[1] < bok[2]*bok[2]) {cout<<"rozwartokatny\n";}
}
else
cout<<"brak\n";
}
return 0;
*/
}
/*
void bubbleSort(double numbers[], int array_size) //sortowanie babelkowe, skopiowana funkcja
{
int i, j, temp;
for (i = (array_size - 1); i > 0; i--)
{
for (j = 1; j <= i; j++)
{
if (numbers[j-1] > numbers[j])
{
temp = numbers[j-1];
numbers[j-1] = numbers[j];
numbers[j] = temp;
}
}
}
}
*/