gerafsfd
Опубликовано 1 год назад по предмету Информатика от gerafsfd

Помогите пожалуйста: Ошибка времени выполнения: Индекс находился вне границ массива. (Не могу найти ошибку) const n=5; var a,b:array[1..n] of integer; i,j:byte; begin for i:=1 to n do begin write('Введите ',i,'-ый(ой) эелемент массива = '); readln(a[i]); end; writeln; writeln(' Массив "А"'); for i:=1 to n do write(' |',a[i],'|'); writeln; j:=0; for i := 1 to n do begin if (b[j]>0) and (b[j] mod b[j]=0) and (b[j] mod 1 =b[j]) then begin inc(j); b[j] := a[i]; end; end; writeln; writeln(' Массив "B"'); for i := 1 to j do write(' |',a[i],'|'); writeln; end.

  1. Ответ
    Ответ дан Blogger76
    Обратите внимание на циклfor i:=n downto p do // вставка p   for j:=1 to n+1 do     c[i+1,j]:=c[i,j];У Вас массив с описан как c:array[1..n,1..n+1] of integer;В то же время, первый индекс у Вас в цикле меняется от  n+1 до p+1 (n+1 выходит за границу), а второй - от 1 до n+1 (это допустимо)
    1. Ответ
      Ответ дан gerafsfd
      там ошибка заключается в переходе границ массива, но я её не могу найти. В Writeln верно всё же.
    2. Ответ
      Ответ дан Blogger76
      щас исправлю секунду
    3. Ответ
      Ответ дан Blogger76
      Обратите внимание на циклfor i:=n downto p do // вставка p   for j:=1 to n+1 do     c[i+1,j]:=c[i,j];У Вас массив с описан как c:array[1..n,1..n+1] of integer;В то же время, первый индекс у Вас в цикле меняется от  n+1 до p+1 (n+1 выходит за границу), а второй - от 1 до n+1 (это допустимо)Подробнее - на Znanija.com - https://znanija.com/task/15699228#readmore
    4. Ответ
      Ответ дан gerafsfd
      у меня в массиве нету c:array[1..n,1..n+1] of integer, у меня вообще одномерный массив)
    5. Ответ
      Ответ дан gerafsfd
      у меня нужно перевести элементы с массива А в В, (переводить только те числа, которые являются неотрицательными и простыми.)
Не тот ответ, который вам нужен?
Найди нужный
Самые новые вопросы
Cjabz
Английский язык - 2 месяца назад

College reconstruction (1) our life goes on and nothing can stay the same for a long time without being changed to satisfy modern needs. the college plans to modernize its current site in a multimillion pound investment to upgrade its buildings and create a new campus. the college has secured support and funding for the project and is now looking for a suitable developer to take the project forward. although no formal plans have been filed at this stage, the college administration aims to reconstruct the existing location with new buildings in one area and sell the remaining land for further development. the total amount of spending for the whole project will be about £40 million. (2) we are aware of people’s worries concerning the redevelopment of the site, but we cannot continue in the present buildings in the long term. they have become tired and unworkable and are now proving very costly to maintain – that is money that should be spent directly on teaching and learning. the buildings do not meet our needs for the 21st century and our students’ requirements. frankly speaking they are outdated. (3) the quality of the teaching and learning at the college will always be the most important thing. that’s why we intend to create a brand new college campus. we want our students to have the opportunity to learn in modern, up-to-date facilities. this investment is timed to make sure that our future students will also have top-class facilities. (4) during the creation of our new campus, we aim to ensure that the reconstruction takes place away from any buildings that will still be in use. an appraisal of all the existing buildings will be carried out to make sure that they are capable of providing a suitable learning environment until the new buildings are complete. if necessary, some money will be available to ensure that these buildings remain fit-for-purpose until the new buildings are ready. (5) we are determined to work closely with our local neighbors on this project. though there will be a formal public consultation process as part of the planning procedures, we will also be inviting our immediate local residents to more informal meetings where we can pay our full attention to their views and opinions. our consultants are beginning to work on putting together plans that will give us an idea of what the new campus will look like. we will consult closely with local people as the project progresses. our intention is to create a college that benefits everyone. задание 9. cоставьте 10 вопросов различного типа к любым предложениям из текста.

Задай вопрос