Const n = 5; var i: integer; a: array[1..n * 2 + 1] of integer; begin writeln('исходный массив: '); for i : = 1 to 2 * n do begin a[i] : = random(99) + 1; write(a[i] : 5); end; for i : = 2 * n + 1 downto n + 1 do a[i] : = a[i - 1]; a[n + 1] : = 0; writeln(); writeln('полученный массив: '); for i : = 1 to 2 * n + 1 do write(a[i] : 5); end.
#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;
}
Объяснение: пойдёт?