Форум программистов, компьютерный форум, киберфорум
PascalABC.NET
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.60/5: Рейтинг темы: голосов - 5, средняя оценка - 4.60
0 / 0 / 0
Регистрация: 22.10.2020
Сообщений: 1
1

Нельзя преобразовать тип array 1.10 of integer к array of integer

22.10.2020, 01:47. Показов 857. Ответов 1

Author24 — интернет-сервис помощи студентам
Здравствуйте! выскакивает ошибка "Нельзя преобразовать тип array 1.10 of integer к array of integer" Как исправить?
Ниже код

Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const
const_mas = 10;
//
//Поиск индекса первого четного числа
//
function search_first_index(const massive:array of integer):integer;
  var i, first_index: integer;
  begin
    for i:= 0 to const_mas do;
      begin
        if massive[i] mod 2 = 0 then
          begin
            first_index:= i
          end
        else 
          begin
            first_index:=0
          end;
      end;
      search_first_index:=first_index
  end;
//
//Поиск индекса последнего четного числа
//
function search_last_index(const massive:array of integer):integer;
  var i, last_index: integer;
  begin
    for i:= const_mas downto 1 do;
      begin
        if massive[i] mod 2 = 0 then
          begin
            last_index:= i
          end
        else 
          begin
            last_index:=0
          end;
      end;
      search_last_index:=last_index
  end;
  
var i, first_index, last_index: integer;
 massive: array[1..const_mas] of integer;
 new_massive: array[1..const_mas] of integer;
    begin
      writeln('введите числа');
      for i:= 1 to const_mas do
        begin
          read(massive[i]);
        end;
        first_index:=search_first_index(massive);
        last_index:=search_last_index(massive);
          if (first_index = last_index) or (first_index = 0) then
            writeln('Пустое множество')
        else 
          for i:=first_index to last_index do
          begin
            new_massive[i]:=i;
            write(new_massive)
          end;
        end.
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
22.10.2020, 01:47
Ответы с готовыми решениями:

Выдает ошибку:Нельзя преобразовать тип array . of integer к array . of integer
Program1.pas(44) : Нельзя преобразовать тип array of array of integer к array of array of...

Нельзя преобразовать тип array of integer к array of integer
program DijkstraAlgorithm; uses crt; const V=6; inf=100000; type vektor=array of integer; ...

Ошибка : Нельзя преобразовать тип array [1..8] of integer к integer
Дана целочисленная матрица В размером 5х8. Получить массив С из 0 и 1, в котором Ci=1, если в i –ой...

Нельзя преобразовать тип array [1.10] of integer к integer
Не робит код в этом месте( uses GraphABC; ... var v: array of Picture; x2,y2: array of...

1
5079 / 2651 / 2349
Регистрация: 10.12.2014
Сообщений: 10,028
22.10.2020, 04:01 2
Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const
  const_mas = 10;
//
//Поиск индекса первого четного числа
//
function search_first_index(const massive: array of integer):=
if massive.Any(x->x.isEven) then massive.Select((x,i)->(x,i)).Where(x->x[0].isEven).First[1]
else -1;
 
//
//Поиск индекса последнего четного числа
//
function search_last_index(const massive: array of integer):=
if massive.Any(x->x.isEven) then massive.Select((x,i)->(x,i)).Where(x->x[0].isEven).Last[1]
else -1;
 
begin
  var massive := ReadArrInteger('введите числа:', const_mas);
  var first_index := search_first_index(massive);
  var last_index := search_last_index(massive);
  if first_index = last_index then
    writeln('Пустое множество')
  else 
    begin
      var new_massive := massive.Select((x,i)->i.InRange(first_index,last_index)?1:0);
      new_massive.Println;
    end;
end.
0
22.10.2020, 04:01
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
22.10.2020, 04:01
Помогаю со студенческими работами здесь

Нельзя преобразовать тип integer к array [1.8] of integer
Естественное слияние.pas(116) : Нельзя преобразовать тип integer к array of integer program cal;...

Нельзя преобразовать тип array [1.10] of integer к integer
Пытаюсь преобразовать программный код Mathcad в Паскаль Тут же выходит ошибка, - Нельзя...

Нельзя преобразовать тип function(z: integer;w: integer;e: integer): real к real
program pract18; uses crt; var x,a,i,k:integer; y:real; function prm1 (z,w,e:integer):real; ...

Ошибка в программе: Нельзя преобразовать тип array [0..10] of real к array of real
program SimpsonIntegral_TabularedFunc_RegularGrid; { Вычисление интеграла } function...

Ошибка в программе: Нельзя преобразовать тип array [0..8] of real к array of real
program LagrangeInterp_RegularInGrid_RegularOutGrid; { Интерполяция } procedure LagrangeInterp...

Нельзя преобразовать тип array of char к array of char
ЭТО КАК? function ToWordsMy(Self, ForChange, ToChange: string): sequence of string;...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru