Sub test() 'массив и диапазон для примера m = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) i1 = 2 'с 3-го злемента (0,1,2) i2 = 7 'по восьмой 'собственно, сам алгоритм for x = i1 to i2 - 1 for y = x + 1 to i2 if m(x) < m(y) then tmp = m(x): m(x) = m(y): m(y) = tmp next y, x msgbox join(m, "; ") 'это просто проверка end sub надеюсь
neblondinka19
17.11.2021
Type goods = record name: string; price: real; end; const goods_count = 5; var goodslist: array[1..goods_count] of goods; id: integer; begin goodslist[1].name: ='iphone 5s'; goodslist[1].price: =760.0; goodslist[2].name: ='samsung galaxy s5'; goodslist[2].price: =540.0; goodslist[3].name: ='simens m60'; goodslist[3].price: =12.5; goodslist[4].name: ='htc one x'; goodslist[4].price: =450.5; goodslist[5].name: ='lg l9'; goodslist[5].price: =600.0; write('write goods id: '); readln(id); if ( ( id < 0 ) or ( id > goods_count ) ) then writeln('wrong id') else writeln(goodslist[id].name,' price =',goodslist[id].price); end.
nasrelza1012
17.11.2021
#include < iostream> #include < string> int main() { std: : string str; getline(std: : cin,str); const int n = 5; std: : string c[n] = { "=", "==", "! =", "a +=", "a -=" }; std: : string psl[n] = { ": =", "=", "#", "a = a +", "a = a -" }; for (unsigned int i = n-1; i > 0; { int p = str.find(c[i]); while (p > 0) { str.replace(p, c[i]. psl[i]); p = str.find(c[i]); } } std: : cout < < str; return 0; }
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Написать программу в паскале! упорядочить массив в интервале от i1 до i2 по убыванию