English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i get this msg:
wrong number of parameters specified.

and heres what i wrote:
program test;
var count, n : integer;
procedure print(indexx,n:integer);
begin
n:= 0;
indexx:=n+1;
writeln('the index is ',indexx);
if (indexx > 0) and (indexx<5) then
print(indexx);
end;

begin
writeln('write a number more than 0 and less than 5 to see the loop');
readln(count);
print(count);
readln;
end.

2007-03-10 02:53:05 · 8 answers · asked by Anonymous in Computers & Internet Programming & Design

8 answers

u deifned procedure print with 2 parameters, but when u called it, u only passed one (that's the wrong number of parameters)
try dropping the indexx part from the definition

2007-03-10 04:12:22 · answer #1 · answered by Khaled Z 3 · 0 0

you have specified a procedure with 2 parameters:

procedure print(indexx, n: integer)

indexx and n are parameters

however you supply only one parameter when calling the function.

i looked at your code and found out that the indexx parameter is completely unneccessary since you assign to it n + 1 regardles its value. so just remove it from the procedure's argument list and declare it inside the procedure

procedure print(n: integer);
var indexx: integer;
begin
n:= 0;
indexx:=n+1;
writeln('the index is ',indexx);
if (indexx > 0) and (indexx<5) then
print(indexx);
end;

2007-03-10 11:11:53 · answer #2 · answered by void7x 2 · 0 0

your print() procedure expects 2 parameters:

procedure print(indexx, n:integer);

you only placed 1 when you called it:

begin
writeln('write a number more than 0 and less than 5 to see the loop');
readln(count);
print(count); <<-------------------
readln;
end.

2007-03-10 11:12:03 · answer #3 · answered by solitaryfalcon 2 · 0 0

in this line:

procedure print(indexx,n:integer);

you have two parameters sperated by commas.

In this line, calling that one, you only supply one parameter:
print(indexx);

so try changing your code like this:

procedure print(n:integer);

or something like that.

hope that helps

Philip

2007-03-10 11:10:04 · answer #4 · answered by Our Man In Bananas 6 · 0 0

In pascal, what does COUNT represent?
(a) Integer
(b) Real
(c) String
(d) Char

2014-05-31 14:31:19 · answer #5 · answered by Ade Kumar 1 · 0 0

i think that your programe is a bit logical wrong!
you don t include number 4!
that means that if you write the number 4

count =4
=>
n=4
n+1=5

that is not <5
that means that the program will print nothing....

2007-03-10 11:09:51 · answer #6 · answered by Anonymous · 0 0

Missing parameter or too many parameters

You confused the function and forgot a parameter or added a parameter too much.

2007-03-10 10:58:00 · answer #7 · answered by ? 2 · 1 0

I'm not sure, as I don't normally use pascal.

But here is a reference from MIT they should be able to help.

2007-03-10 11:06:29 · answer #8 · answered by Old guy 124 6 · 1 0

fedest.com, questions and answers