Запишите фрагмент программы, в которой массив А, объявленный как А: array[2..16] of integer; заполняется по следующему правилу: каждый элемент массива в 3 раза больше своего индекса
//Описание добавить не вышло на сайт, посему - в файле
#include "stdafx.h" #include <conio.h>
void swap(short &a, short &b) { short c = a; a = b;
b = c; }
void sort(short &a, short &b, short &c) { short min = a, max = c; if (min > b) min = b; if (min > c) min = c; if (max < a) max = a; if (max < b) max = b; b = a + b + c - min - max; a = min; c = max; }
if ((a1 == a2) && (b1 == b2) && (c1 == c2)) printf("Boxes are equal"); else if ((a1 <= a2) && (b1 <= b2) && (c1 <= c2)) printf_s("The first box is smaller than the second one"); else if ((a2 <= a1) && (b2 <= b1) && (c2 <= c1)) printf_s("The first box is larger than the second one"); else printf_s("Boxes are incomparable");
var
s: string;
i, count: integer;
begin
writeln('Vvedite stroky: ');
readln(s);
for i := 1 to length(s) - 2 do
if copy(s, i, 3) = 'abc' then
count := count + 1;
writeln('Kol-vo: ', count);
end.
2.
var
s1, s2: string;
i, len1, len2: integer;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
len1 := length(s1);
len2 := length(s2);
if len1 > len2 then writeln('1 stroka dlinnee')
else if len1 < len2 then writeln('2 stroka dlinnee')
else writeln('dlini strok ravnie')
end.
3.
var
s1, s2, s3: string;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
s3 := s1[1] + s1[2] + s2[1] + s2[2];
writeln('Novaja stroka: ', s3);
end.