1) От 10 до 14
2) random(1, 10); random(-10,10); random(50,100);
3)
var a:array[1..100] of integer;
i, p, o:integer;
begin
p := 0;
o := 0;
for i := 1 to 100 do
a[i] := random(-20, 20);
writeln(a);
for i := 1 to 100 do begin
if a[i] >= 0 then p := p + 1
else o := o + 1;
end;
writeln('Положительных: ' + p);
writeln('Отрицательных: ' + o);
end.
4)
var a:array[1..20] of integer;
b:array[1..20] of integer;
i:integer;
randomize;
for i := 1 to 20 do
a[i] := random(1, 5);
b[i] := random(1, 5);
for i := 1 to 20 do begin
if a[i] = b[i] then begin
writeln('Номер: ' + i);
writeln('Значение: ' + a[i]);
#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;
s = 4 * 3.14 * r * r;
v = 3.14159 * pow(r, 3);
sphere();
sphere() : circle(circle, double = 1.0);
sphere (int = 0, int = 0, double = 1.0) ;
circle::out();
cout << ", радиус: " << r << ", длина: " << ", площадь: " << s;
int main(){
setlocale(LC_ALL, "ru");
circle a(2, 15, 4);
a.out();
sphere b;
system("pause");
return 0;
Объяснение: пойдёт?
1) От 10 до 14
2) random(1, 10); random(-10,10); random(50,100);
3)
var a:array[1..100] of integer;
i, p, o:integer;
begin
p := 0;
o := 0;
for i := 1 to 100 do
a[i] := random(-20, 20);
writeln(a);
for i := 1 to 100 do begin
if a[i] >= 0 then p := p + 1
else o := o + 1;
end;
writeln('Положительных: ' + p);
writeln('Отрицательных: ' + o);
end.
4)
var a:array[1..20] of integer;
b:array[1..20] of integer;
i:integer;
begin
randomize;
for i := 1 to 20 do
begin
a[i] := random(1, 5);
b[i] := random(1, 5);
end;
for i := 1 to 20 do begin
if a[i] = b[i] then begin
writeln('Номер: ' + i);
writeln('Значение: ' + a[i]);
end;
end;
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;
}
Объяснение: пойдёт?