Help please

program ro;
uses wincrt;
type
slog=record
ime:string;
staz:integer;
staz_uro:integer
end;
type
niz=array[1..30] of slog;
var
radnik:niz;
pom:slog;
n,i,j:integer;
procedure razmeni(var p,q:integer);
var pom:integer;
begin
pom:=p;
p:=q;
q:=pom
end;
begin
write('unesi broj radnika:');
readln(n);
writeln('unesi podatke o radnicima:');
for i:=1 to n do
begin
with radnik[i] do
begin
write('Ime '); readln(ime);
write('Ukupan radni staz ');
readln(staz);
write('Staz u radnoj organizaciji ');
readln(staz_uro);
writeln
end
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if radnik[i].staz< radnik[j].staz then
razmeni(radnik[i], radnik[j]);
writeln('Sortirani podaci po ukupnoj duzini radnog staza:');
for i:=1 to n do
with radnik[i] do
begin
writeln('Ime: ',ime);
writeln('Ukupan staz: ',staz);
writeln('Staz u radnoj organizaciji: ',staz_uro);
writeln
end;
writeln;
writeln('Imena radnika sa 10 god radnog staza_uro: ');
for i:=1 to n do
if radnik[i].staz_uro=10 then writeln (radnik[i].ime);
end.



Error 26 type missmatch in this line
razmeni(radnik[i], radnik[j]);

Comments

  • quikcarlxquikcarlx Hollywood, Fl
    There are a few things you should do: 1) format your program; put some indentation in it so the lines are readable, not all jammed to the left to conserve space, 2) put some spaces between the words and lines, 3) throw some comments in there to help yourself and others read and understand your program. Okay, now to maybe get your program to compile.

    Change
    [code]{ procedure razmeni(var p,q:integer); } procedure razmeni ( var p, q : slog );[/code] The 2 arguments that you are passing are really [color=Green]record[/color]s and not [color=Red]integer[/color]s.
  • quikcarlxquikcarlx Hollywood, Fl
    I got to looking at your jammed up to the left program and could see that the procedure might have another problem. So I made a change and put it through my Free Pascal 2.6 compiler and it looks like it will run. So here is the code:
    [code] procedure razmeni ( var p, q : slog );

    var
    pom : slog;

    begin
    pom := p;
    p := q;
    q := pom
    end;[/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion