#include <iostream>
using namespace std;
class circle {
public:
int x, y;
double r, s;
circle()
{
x = 0;
y = 0;
r = 0;
}
circle( int a = 0, int b = 0, double c = 0 )
{
set(a, b, c);
}
void out()
{
cout << "Координаты: (" << x << ", " << y << ") Радиус: "<< r << " Площадь: " << endl;
}
void set(int a, int b, double c)
{
x = a;
y = b;
r = c;
}
void calculate() {
s = r * r * 3.14159;
}
};
class sphere : public circle {
private:
double v;
void calculate() {
s = 4 * 3.14 * r * r;
v = 3.14159 * pow(r, 3);
}
public:
sphere();
sphere() : circle(circle, double = 1.0);
sphere (int = 0, int = 0, double = 1.0) ;
void out()
{
circle::out();
cout << ", радиус: " << r << ", длина: " << ", площадь: " << s;
}
};
int main(){
setlocale(LC_ALL, "ru");
circle a(2, 15, 4);
a.out();
sphere b;
system("pause");
return 0;
}
Объяснение: пойдёт?
var
a: array of longint;
y: array of longint;
b: longint;
i, k, k2: byte;
//
begin
randomize;
write ('Введите кол-во элементов изначального массива: ');
read (k);
setLength (a, k);
for i:=0 to k-1 do
{read (a[i]);} a[i]:=random (100000);
write ('Введите величину b: ');
read (b);
for i:=0 to k-1 do
if a[i]<=b then
begin
k2:=k2+1;
setLength (y, k2);
y[k2-1]:=a[i];
end;
write (a, y);
end.