trast45
?>

Программисты. basic составьте подпрограмму, изменяющую одномерный массив чисел делением его положительных элементов на свои индексы и определяющую число измененных элементов. используя эту процедуру, определите, в каком из двух заданных одномерных массивов а или в больше измененных элементов, а также выведите измененные массивы а и в. если же число измененных элементов одинаково, то выведите соответствующее сообщение

Информатика

Ответы

Femida76
  private sub form1_load(byval sender as system.object, byval e as system.eventargs) handles mybase.load         dim a() as integer         dim b() as integer         randomize()         dim k as integer         dim i as integer         i = rnd() * 100 + 1         redim a(i)         for k = 0 to i             a(k) = rnd() * -1000 + 500         next         i = rnd() * 100 + 1         redim b(i)         for k = 0 to i             b(k) = rnd() * -1000 + 500         next         dim counta as integer         dim countb as integer         counta = change(a)         countb = change(b)         dim msg_a as string         for i = 0 to ubound(a) - 1             msg_a = msg_a & a(i) & vbcrlf '   c2fbefeeebede8eb3a20caf3eff0e8ffedeee220c42ec52e2028632920442d6d6f6e3535         next         dim msg_b as string         for i = 0 to ubound(b) - 1             msg_b = msg_b & b(i) & vbcrlf         next         if counta = countb then msgbox("количество измененных элементов в двух массивах одинаково")         msgbox(msg_a)         msgbox(msg_b)     end sub     private function change(byref massiv() as integer) as integer         dim count as integer         dim i as integer         for i = 0 to ubound(massiv) - 1             if massiv(i) > 0 then massiv(i) = massiv(i) / i : count = count + 1         next         return count     end function
chapaevval
Const    letters = ['a'..'z', 'a'..'z'];   lineends = [#13, #10, #0, '.'];   max_len = 255; var    txt: array [0..max_len] of char;   bnd: array [0..max_len, 0..1] of integer;   tsz, bsz: integer; // размеры массивов   isletter, isword, f1, f2: boolean;   i, j: integer; begin   repeat     read(txt[tsz]);     // определение границ слов         isletter : = txt[tsz] in letters;     if isletter and not isword then       bnd[bsz, 0] : = tsz;     if isword and not isletter then begin       bnd[bsz, 1] : = tsz;       bsz : = bsz + 1;     end;           isword : = isletter;     tsz : = tsz + 1;   until txt[tsz-1] in lineends;       if bsz > 1 then begin       for i : = 0 to bsz-2 do begin       j : = 0; f2 : = true;       f1 : = (bnd[bsz-1, 1] - bnd[bsz-1, 0]) = (bnd[i, 1]-bnd[i, 0]); // совпадение длин               while (j < bnd[i, 1] - bnd[i, 0]) and f2 do begin         f1 : = f1 and (txt[bnd[i, 0] + j] = txt[bnd[bsz-1, 0] + j]);         f2 : = f2 and (lowcase(txt[bnd[i, 0] + j]) = chr(ord('a') + j));         j : = j + 1;       end;               // вывод       if f2 and not f1 then begin         for j : = bnd[i, 0] to bnd[i, 1] - 1 do           write(txt[j]);         writeln;       end;     end;   end; end.
ruslanchikagadzhanov
Var   n, i, j, askthemountains: longint;   a: array of longint;   fl: text; begin   assign(fl, 'input.txt');   reset(fl);   readln(fl, n);   setlength(a, n);   for i : = 0 to (n - 1) do     readln(fl, a[i]);   close(fl);   assign(fl, 'output.txt');   rewrite(fl);       for i : = 0 to n - 1 do     for j : = i to n - 1 do       if (a[i] > a[j]) then       begin         askthemountains : = a[i];         a[i] : = a[j];         a[j] : = askthemountains;       end;   for i : = 0 to n-1 do     writeln(fl, a[i]);   close(fl); end.

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

Программисты. basic составьте подпрограмму, изменяющую одномерный массив чисел делением его положительных элементов на свои индексы и определяющую число измененных элементов. используя эту процедуру, определите, в каком из двух заданных одномерных массивов а или в больше измененных элементов, а также выведите измененные массивы а и в. если же число измененных элементов одинаково, то выведите соответствующее сообщение
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

Воронина
lazareva
KseniGum9
Сайжанов
horizma609
zloshop9
slspam
kbndbyb6
Nikolaevich1534
Linichuk
magichands68
ntyremsk1
palmhold578
Aleksandrovich-Mayatskikh
Дмитрий Бундин
▲