for (i = 0; i < kol; i++) {
cout « as[i].punkt_naznachenia « " ";
cout « as[i].nomer_reisa « " ";
cout « as[i].tip_samoleta « endl;
}
char poisk_samoletov[40];
cout « "Punkt naznachenia reisa " « endl;
cin » poisk_samoletov;
bool f = false;
for (i = 0; i < kol; i++)
if (strcmp(as[i].punkt_naznachenia, poisk_samoletov) == 0)
{
cout « "Nomer reisa ";
cout « as[i].nomer_reisa « endl;
cout « "Tip samoleta ";
cout « as[i].tip_samoleta « endl;
f = true;
}
if (!f) {
cout « "Net takogo punkta naznachenia reisa " « endl;
}
system("pause");
}
Объяснение:
# Python 3.x
import numpy
# Вводим массив случайных целых чисел диапазона от -1000 до 1000.
array=numpy.array((numpy.random.random(30) * 2 - 1) * 1000, numpy.int)
print(array)
# Считаем сумму среза массива по условию нечетности элементов.
sumary=numpy.sum(array[array % 2 != 0])
print("Sumary: ", sumary)
#
A=int(input("A: "))
indexs=numpy.where(array > A)[0]
result=[str(index) for index in indexs] # для метода join требуются строковые значения.
print(f"Here indexs, more that {A}: ", ', '.join(result))
#
k=int(input("k: "))
positives=array[array >= 0]
required=positives[positives % k == 0]
print(len(required), f" positive items divisible {k}")