initial
This commit is contained in:
commit
2802401eee
79 changed files with 2650 additions and 0 deletions
24
1sem/programming basics/z2/4.cpp
Normal file
24
1sem/programming basics/z2/4.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// pb_z2_4.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include <clocale>
|
||||
#include <afxres.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
SetConsoleCP(CP_UTF8);
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
setlocale(LC_ALL, "ru_RU.UTF-8");
|
||||
|
||||
double x, a, b, c, d;
|
||||
printf("x [a b] [c d] >>");
|
||||
scanf("%lf %lf %lf %lf %lf", &x, &a, &b, &c, &d);
|
||||
if ((fmin(a, b) <= x && x <= fmax(a, b)) || (fmin(c, d) <= x && x <= fmax(c, d))) {
|
||||
printf("Принадлежит");
|
||||
}
|
||||
else {
|
||||
printf("Не принадлежит");
|
||||
};
|
||||
}
|
||||
33
1sem/programming basics/z2/5.cpp
Normal file
33
1sem/programming basics/z2/5.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// pb_z2_5.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include <clocale>
|
||||
#include <afxres.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
SetConsoleCP(CP_UTF8);
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
setlocale(LC_ALL, "ru_RU.UTF-8");
|
||||
|
||||
double a1, a2, b1, b2;
|
||||
printf("[a1 a2] [b1, b2] >>");
|
||||
scanf("%lf %lf %lf %lf", &a1, &a2, &b1, &b2);
|
||||
if (fmin(a1, a2) == fmin(b1, b2) && fmax(a1, a2) == fmax(b1, b2)) {
|
||||
printf("А равно B");
|
||||
}
|
||||
else if (fmin(a1, a2) >= fmin(b1, b2) && fmax(a1, a2) <= fmax(b1, b2)) {
|
||||
printf("А внутри B");
|
||||
}
|
||||
else if (fmin(b1, b2) >= fmin(a1, a2) && fmax(b1, b2) <= fmax(a1, a2)) {
|
||||
printf("B внутри A");
|
||||
}
|
||||
else if ((fmin(b1, b2) <= fmin(a1, a2) && fmin(a1, a2) <= fmax(b1, b2)) || (fmin(b1, b2) <= fmax(a1, a2) && fmax(a1, a2) <= fmax(b1, b2))) {
|
||||
printf("Другое пересечение");
|
||||
}
|
||||
else {
|
||||
printf("Нет пересечения");
|
||||
}
|
||||
}
|
||||
32
1sem/programming basics/z2/6.cpp
Normal file
32
1sem/programming basics/z2/6.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// pb_z2_6.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include <clocale>
|
||||
#include <afxres.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
SetConsoleCP(CP_UTF8);
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
setlocale(LC_ALL, "ru_RU.UTF-8");
|
||||
|
||||
double a, b, c, d;
|
||||
printf("a b c >>");
|
||||
scanf("%lf %lf %lf", &a, &b, &c);
|
||||
if (a == 0) {
|
||||
printf("Недопустимое значение `a`");
|
||||
return 0;
|
||||
}
|
||||
d = b*b-4*a*c;
|
||||
if (d < 0) {
|
||||
printf("Действительных корней нет");
|
||||
}
|
||||
else if (d == 0) {
|
||||
printf("x= %lf", -b/(2*a));
|
||||
}
|
||||
else {
|
||||
printf("x1= %lf\nx2= %lf", (-b+sqrt(d))/(2*a), (-b-sqrt(d))/(2*a));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue