Задача 1
var
x1, y1, x2, y2, l: real;
begin
Writeln('Введите значения (x1,y1,x2,y2)');
Read(x1, y1, x2, y2);
l := Sqrt(Sqr(x1 - x2) + Sqr(y1 - y2));
Writeln('Расстояние: ', l:3:2);
end.
Тестовое решение:
Введите значения (x1,y1,x2,y2)
2 3 4 5
Расстояние: 2.83
Задача 2
var
a, b, c, p, s: real;
begin
Writeln('Введите ABC');
Read(a, b, c);
P := (a + b + c)/2;
S := Sqrt(p * (p - a) * (p - b) * (p - c));
Writeln('Площадь по Герону: ', S:3:2);
end.
Тестовое решение:
Введите ABC
2 3 4
Площадь по Герону: 2.90
#include <cstring>
int main() {
char* text1 = "Слово";
char* text = "Как то текст с гласными на конце кок";
char* newText = new char[strlen(text)];
int lastStop = 0, lastIter = 0;
for (int i = 0; text[i] != '\0'; i++) {
bool copyIt = false;
if (text[i] == ' ') lastStop = i;
if (text[i + 1] == ' ' || text[i + 1] == '\0') {
for (int j = 0; text1[j] != '\0'; j++) {
if (text[i] == text1[j]) {
copyIt = false; break;
}
copyIt = true;
}
}
if (copyIt == true) {
for (int j = lastStop; j <= i; j++, lastIter++)
newText[lastIter] = text[j];
}
}
for (int i = 0; i < lastIter; i++)
std::cout << newText[i];
std::cout << "\n";
return 0;
}