ответь писменно на во Для чего служит группа элементов Названия? 2. Каково назначение группы элементов Предметный указатель? 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 arr: array[1..27] of integer; summ: integer; begin Randomize; for var i := 1 to 27 do begin arr[i] := random(-5, 5); summ := summ + arr[i]; end; writeln('Массив: ',arr); writeln('Сумма всех элементов массива = ',summ); for var i := 1 to 27 do if arr[i] = 0 then arr[i] := summ; writeln('Массив: ',arr); end.
пример работы: Массив: [5,-1,1,5,4,-2,-3,0,3,5,-3,-4,3,0,-1,-4,5,-2,1,-4,5,2,-4,5,4,-5,-1] Сумма всех элементов массива = 14 Массив: [5,-1,1,5,4,-2,-3,14,3,5,-3,-4,3,14,-1,-4,5,-2,1,-4,5,2,-4,5,4,-5,-1]
var arr: array of integer; n,k,m: integer; begin write('Введи n: '); readln(n); Randomize; arr:= new integer[n]; for var i := 0 to n-1 do arr[i] := random(-5, 5); writeln('Массив: ',arr); for var i := 0 to n-1 do begin if arr[i]<0 then inc(k); if (i>=1) and (i<=6) then inc(m); if (i>=6) and (arr[i]>=0) then arr[i]:=1; end; writeln('Количество отрицательных элементов массива = ',k); writeln('Количество элементов массива в интервале [2..7] = ',m); writeln('Массив: ',arr); end.
Пример работы: Введи n: 5 Массив: [0,1,-4,1,3] Количество отрицательных элементов массива = 1 Количество элементов массива в интервале [2..7] = 4 Массив: [0,1,-4,1,3]
Введи n: 15 Массив: [0,1,4,3,-3,5,-4,-1,1,-2,3,1,-4,1,3] Количество отрицательных элементов массива = 5 Количество элементов массива в интервале [2..7] = 6 Массив: [0,1,4,3,-3,5,-4,-1,1,-2,1,1,-4,1,1]
#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;
}
int main()
{
short a1, b1, c1, a2, b2, c2;
scanf_s("%hd %hd %hd", &a1, &b1, &c1);
scanf_s("%hd %hd %hd", &a2, &b2, &c2);
sort(a1, b1, c1);
sort(a2, b2, c2);
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");
_getch();
return 0;
}