0 / 0 / 0
Регистрация: 08.06.2018
Сообщений: 1
1

Код с ошибкой, Error: Found declaration, Error: Wrong number of parameters specified for call

08.06.2018, 08:53. Показов 4111. Ответов 1

Студворк — интернет-сервис помощи студентам
Задние: Заполнить двумерный массив случайными числами. Размерность массива и диапазон генерации вводятся с клавиатуры. Составить программу, которая подсчитывает сумму всех элементов массива. Затем организовать формирование нового массива С, в котором элементы, лежащие не на главной диагонали, равны 1, а остальные элементы равны соответствующим элементам исходного массива С
Код;
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
procedure random (c, x, y:integer; var r:integer);
  begin
     case c of
                1: r:=Random((y)+(x)+1)+x;
                2: r:=Random((y)+(x)+1)+y;
                3: r:=Random(Y-x+1)+x;
                4: r:=Random(x-y+1)+y;
                5: r:=Random(x+y);
                6: r:=Random((x+y))-(x+y);
                7: r:=x;
                8: r:=Random(((x)-(y)))-(x);
                9: r:=Random(((x)-(y)))-(y);
        end;
   end;
var
  a,b: array of array of integer;
  i,j,x,y,c,m,p,sum:integer;  
begin
Randomize;
sum:=0;
writeln('Кол-во строк и столбцов массива? //X,Y\\  ');
read(i,j); //Размерность массива
writeln('Диапазон чисел //от X,до Y\\ '); 
read(x,y); //и диапазон генерации вводятся с клавиатуры.
if (x=y) then
c:=7
else
if(x<0) and (y<0) then 
if (x<y) then 
c:=8
else
c:=9
else
if (x=0) or (y=0) then 
if(x<0) or (y<0) then 
c:=6
else
c:=5
else
if(x<0) or (y<0) then 
if (x<y) then 
c:=1
else 
c:=2
else
if (x<y) then 
c:=3
else 
c:=4;
SetLength(a,i);
for  m:=0 to i-1 do
  SetLength(a[m],j);
  SetLength(b,i);
  for  m:=0 to i-1 do
  SetLength(b[m],j);    
for  m:=0 to i-1 do begin  
writeln();
     for  p:=0 to j-1 do   begin                     
     random(c,x,y,a[m,p]);    //Заполнить двумерный массив случайными числами.
 sum:=sum+a[m,p];  //вычисляет сумму всех элементов массива
          write (a[m,p]:3,' ':3);
           end; 
         end;  
        c:=0;   
        writeln('Сумма =',sum);  
 for  m:=0 to i-1 do begin //новый массив С//
writeln();
     for  p:=0 to j-1 do  begin            
 if (a[m,p] <0) then          begin  
       b[m,p]:=1; //в котором заменить отрицательные элементы исходного массива на 1        
   end       
   else         
  b[m,p]:=a[m,p]; //а значения остальных элементов оставить без изменения 
   write(b[m, p]:3, ' ':3);      
  end;         
 end;         
 writeln('kol=',c);        
  a:=NIL;          
b:=NIL;     
end.
Ошибка:
fpc "56.pas" (в каталоге: /home/misha)
Free Pascal Compiler version 3.0.4+dfsg-18 [2018/04/22] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling 56.pas
56.pas(5,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(6,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(7,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(8,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(9,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(10,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(12,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(13,23) Error: Wrong number of parameters specified for call to "random"
56.pas(2,11) Error: Found declaration: random(SmallInt;SmallInt;SmallInt;var SmallInt);
56.pas(82) Fatal: There were 16 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
Сборка завершилась с ошибкой.
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
08.06.2018, 08:53
Ответы с готовыми решениями:

Поиск в ширину: Wrong number of procedure parameters
Помогите исправить програму поиска в ширину. visited: MassivBool; {матрица смежности графа}...

Метод Гаусса и ошибка Wrong number of parametres specified for call to 'ff'
помогите,пожалуйста, выводит 'wrong number of parametres specified for call to 'ff' ...

Error: Wrong number of parameters specified for call to "Image1MouseUp"
Ситуация в следующем такова: при создании графического редактора в Лазарь я добавил функцию...

Error: Wrong number of parameters specified for call to "Image5Click" при назначении обработчика
Динамически создаем Image. Необходимо чтобы при нажатии на нее вызывалась procedure...

1
Эксперт Pascal/Delphi
6806 / 4565 / 4817
Регистрация: 05.06.2014
Сообщений: 22,438
08.06.2018, 09:09 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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
procedure MyRandom(c, x, y: integer; var r: integer); 
begin
  case c of
    1: r := Random((y) + (x) + 1) + x;
    2: r := Random((y) + (x) + 1) + y;
    3: r := Random(Y - x + 1) + x;
    4: r := Random(x - y + 1) + y;
    5: r := Random(x + y);
    6: r := Random((x + y)) - (x + y);
    7: r := x;
    8: r := Random(((x) - (y))) - (x);
    9: r := Random(((x) - (y))) - (y);
  end;
end;
 
var
  a, b: array of array of integer;
  i, j, x, y, c, m, p, sum: integer;
 
begin
  Randomize;
  sum := 0;
  writeln('Кол-во строк и столбцов массива? //X,Y\\  ');
  read(i, j); //Размерность массива
  writeln('Диапазон чисел //от X,до Y\\ '); 
  read(x, y); //и диапазон генерации вводятся с клавиатуры.
  if (x = y) then
    c := 7
  else
  if(x < 0) and (y < 0) then 
    if (x < y) then 
      c := 8
    else
      c := 9
  else
  if (x = 0) or (y = 0) then 
    if(x < 0) or (y < 0) then 
      c := 6
    else
      c := 5
  else
  if(x < 0) or (y < 0) then 
    if (x < y) then 
      c := 1
    else 
      c := 2
  else
  if (x < y) then 
    c := 3
  else 
    c := 4;
  SetLength(a, i);
  for m := 0 to i - 1 do
    SetLength(a[m], j);
  SetLength(b, i);
  for m := 0 to i - 1 do
    SetLength(b[m], j);    
  for m := 0 to i - 1 do 
  begin
    writeln();
    for p := 0 to j - 1 do 
    begin
      MyRandom(c, x, y, a[m, p]);    //Заполнить двумерный массив случайными числами.
      sum := sum + a[m, p];  //вычисляет сумму всех элементов массива
      write(a[m, p]:3, ' ':3);
    end; 
  end;  
  c := 0;   
  writeln('Сумма =', sum);  
  for m := 0 to i - 1 do 
  begin//новый массив С//
    writeln();
    for p := 0 to j - 1 do 
    begin
      if (a[m, p] < 0) then begin
        b[m, p] := 1; //в котором заменить отрицательные элементы исходного массива на 1        
      end       
      else         
        b[m, p] := a[m, p]; //а значения остальных элементов оставить без изменения 
      write(b[m, p]:3, ' ':3);      
    end;         
  end;         
  writeln('kol=', c);        
  a := nil;          
  b := nil;     
end.
0
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
08.06.2018, 09:09
Помогаю со студенческими работами здесь

Ошибка "Error: Wrong number of parameters specified for call to "FloatToStrF""
и снова я. задание: создайте программу, в которой можно найти максимальное из четырех заданных...

Error. number-53, File not found: vba6.dll. String shell "call.exe"
Есть вопросик. Я вставил в свою прогу этот код: Public Sub StartProgram(StringS As String) Dim...

Wrong number of arguments or invalid property assignment (Error 450)
При выполнении этой программки вылетает вот такое сообщение: Wrong number of arguments or invalid...

[Error] Unit1.pas(43): Declaration expected but end of file found
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics,...


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

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2023, CyberForum.ru