program we;
const
е=0.01;
ro=0.57;
ty=280;
tz=320;
py=180;
p_kr=4.695;
t_kr=190.55;
n=8;
m=21;
type sm=array [1..8] of real;
const x_i: sm=(0.841,0.023,0.069,0.009,0.019,0.014,0.013,0.012);
t_i: sm=(190.55,305.43,369.82,425.16,408.13,469.65,460.39,507.35);
p_i: sm=(46.95,49.76,44.33,38.71,37.19,34.35,34.48,30.72);
var sa,sb: real; i: integer;
a_sm, b_sm,ppkr,tpkr: sm;
p_2,p1,p_sr,p_pr,t_sr,t_pr,pz,dp,t_x,t_pl,g,dt,h,p2,pl,p_x,s,c_r,b,c,a,c_st,f_a,f_b,f_c,z_sr,z,x1,l,sppkr,stpkr: real;
function fz(x1: real): real;
begin
fz: =exp(ln(x1)*3)-sqr(x1)+x1*p_sr*(sqr(sb)*p_sr+sa-sb)-sa*sb*sqr(p_sr);
end;
sa: =0;
sb: =0;
sppkr: =0;
stpkr: =0;
for i: =1 to 8 do
a_sm[i]: =((0.0867*t_i[i])/(p_i[i]*t_sr))*x_i[i];
b_sm[i]: =((0.4278*sqr(t_i[i])*sqrt(/(p_i[i]*sqr(t_sr)*sqrt(*x_i[i];
ppkr[i]: =(p_i[i]*x_i[i]);
tpkr[i]: =(t_i[i]*x_i[i]);
sa: =sa+a_sm[i];
sb: =sb+b_sm[i];
sppkr: =sppkr+ppkr[i];
stpkr: =stpkr+tpkr[i];
l: =0;
for i: =1 to m do
p_2: = py;
t_sr: =(ty+tz)/2;
repeat;
p1: = p_2;
p_sr: =(p1+p_2)/2;
p_pr: =p1/sppkr;
t_pr: =t_sr/stpkr;
a: =0;
b: =1;
repeat
f_a: =fz(a);
f_b: =fz(b);
c: =(a+b)/2;
f_c: =fz(c);
if(f_c*f_a)< 0 then b: =c
else a: =c;
c_st: =(a+b)/2;
until (abs(c_st-c)) z_sr: =c;
s: =0.03415*(ro*l)/(z_sr*t_sr);
pz: =py*exp(s);
p_2: = pz*exp(s);
dp: =pz-p1;
p_2: =pz;
until dp l: =l+100;
writeln ('l=', l, ' p=', p_2, ' z=', z_sr );
end.
ЯП: С++ | можно не писать std:: , если использовать пространство имен: using namespace std;
#include <iostream>
int main() {
const int SIZE = 10;
int regim, sum, max, count;
int arr[SIZE];
for (int i = 0; i < SIZE; i++)
{
std::cin >> arr[i]; // вводим элементы массива
std::cout << arr[i] << "\t"; // выводим массив в консоль
}
std::cin >> regim;
if ((regim > 0) && (regim < 4))
if (regim == 1)
sum += arr[i]; // или sum = sum + arr[i];
std::cout << "Сумма элементов массива = " << sum << std::endl;
else if (regim == 2)
max = arr[0];
if (max < arr[i])
max = arr[i];
std::cout << "Максимальный элемент в массиве = " << max << std::endl;
else
if (arr[i] < 0)
count++;
std::cout << "Число отрицательных элементов в массиве = " << count << std::endl;
std::cout << "Доступен только 1-3 режим!" << std::endl;
return 0;
program we;
const
е=0.01;
ro=0.57;
ty=280;
tz=320;
py=180;
p_kr=4.695;
t_kr=190.55;
n=8;
m=21;
type sm=array [1..8] of real;
const x_i: sm=(0.841,0.023,0.069,0.009,0.019,0.014,0.013,0.012);
t_i: sm=(190.55,305.43,369.82,425.16,408.13,469.65,460.39,507.35);
p_i: sm=(46.95,49.76,44.33,38.71,37.19,34.35,34.48,30.72);
var sa,sb: real; i: integer;
a_sm, b_sm,ppkr,tpkr: sm;
p_2,p1,p_sr,p_pr,t_sr,t_pr,pz,dp,t_x,t_pl,g,dt,h,p2,pl,p_x,s,c_r,b,c,a,c_st,f_a,f_b,f_c,z_sr,z,x1,l,sppkr,stpkr: real;
function fz(x1: real): real;
begin
fz: =exp(ln(x1)*3)-sqr(x1)+x1*p_sr*(sqr(sb)*p_sr+sa-sb)-sa*sb*sqr(p_sr);
end;
begin
sa: =0;
sb: =0;
sppkr: =0;
stpkr: =0;
for i: =1 to 8 do
begin
a_sm[i]: =((0.0867*t_i[i])/(p_i[i]*t_sr))*x_i[i];
b_sm[i]: =((0.4278*sqr(t_i[i])*sqrt(/(p_i[i]*sqr(t_sr)*sqrt(*x_i[i];
ppkr[i]: =(p_i[i]*x_i[i]);
tpkr[i]: =(t_i[i]*x_i[i]);
sa: =sa+a_sm[i];
sb: =sb+b_sm[i];
sppkr: =sppkr+ppkr[i];
stpkr: =stpkr+tpkr[i];
end;
l: =0;
for i: =1 to m do
begin
p_2: = py;
t_sr: =(ty+tz)/2;
repeat;
p1: = p_2;
p_sr: =(p1+p_2)/2;
p_pr: =p1/sppkr;
t_pr: =t_sr/stpkr;
a: =0;
b: =1;
repeat
f_a: =fz(a);
f_b: =fz(b);
c: =(a+b)/2;
f_c: =fz(c);
if(f_c*f_a)< 0 then b: =c
else a: =c;
c_st: =(a+b)/2;
until (abs(c_st-c)) z_sr: =c;
s: =0.03415*(ro*l)/(z_sr*t_sr);
pz: =py*exp(s);
p_2: = pz*exp(s);
dp: =pz-p1;
p_2: =pz;
until dp l: =l+100;
writeln ('l=', l, ' p=', p_2, ' z=', z_sr );
end;
end.
ЯП: С++ | можно не писать std:: , если использовать пространство имен: using namespace std;
#include <iostream>
int main() {
const int SIZE = 10;
int regim, sum, max, count;
int arr[SIZE];
for (int i = 0; i < SIZE; i++)
{
std::cin >> arr[i]; // вводим элементы массива
std::cout << arr[i] << "\t"; // выводим массив в консоль
}
std::cin >> regim;
if ((regim > 0) && (regim < 4))
{
if (regim == 1)
{
for (int i = 0; i < SIZE; i++)
{
sum += arr[i]; // или sum = sum + arr[i];
}
std::cout << "Сумма элементов массива = " << sum << std::endl;
}
else if (regim == 2)
{
max = arr[0];
for (int i = 0; i < SIZE; i++)
{
if (max < arr[i])
max = arr[i];
}
std::cout << "Максимальный элемент в массиве = " << max << std::endl;
}
else
{
for (int i = 0; i < SIZE; i++)
{
if (arr[i] < 0)
count++;
}
std::cout << "Число отрицательных элементов в массиве = " << count << std::endl;
}
}
else
std::cout << "Доступен только 1-3 режим!" << std::endl;
return 0;
}