initial
This commit is contained in:
commit
2802401eee
79 changed files with 2650 additions and 0 deletions
19
1sem/programming basics/z3/7.cpp
Normal file
19
1sem/programming basics/z3/7.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// pb_z3_7.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int find_most_frequent(int a, int b, int c, int d)
|
||||
{
|
||||
int s;
|
||||
s = a + b + c + d;
|
||||
return (s == 2 ? -1 : (s > 2 ? 1 : 0));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int a, d, c, b;
|
||||
cout << ("a,b,c,d=?");
|
||||
cin >> a >> b >> c >> d;
|
||||
cout << find_most_frequent(a, b, c, d);
|
||||
}
|
||||
24
1sem/programming basics/z3/8.cpp
Normal file
24
1sem/programming basics/z3/8.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// pb_z3_8.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
float inline sqr(float i)
|
||||
{
|
||||
return i * i;
|
||||
}
|
||||
|
||||
float dist(float x1, float y1, float x2, float y2)
|
||||
{
|
||||
float d = sqrt(sqr(x2 - x1) + sqr(y2 - y1));
|
||||
return d;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
float x1, y1, x2, y2;
|
||||
cout << "x1,y1,x2,y2\n";
|
||||
cin >> x1>> y1 >> x2 >> y2;
|
||||
cout << dist(x1, y1, x2, y2);
|
||||
}
|
||||
22
1sem/programming basics/z3/9.cpp
Normal file
22
1sem/programming basics/z3/9.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// pb_z3_9.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include<algorithm>
|
||||
using namespace std;
|
||||
|
||||
float min_or_max(float a, float b, float c)
|
||||
{
|
||||
if (a > 0.5)
|
||||
return max(b, c);
|
||||
else
|
||||
return min(b, c);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
float a, b, c;
|
||||
cin >> a >> b >> c;
|
||||
float d = min_or_max(a, b, c);
|
||||
cout << d << endl;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue