Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help please

zmajzmaj Posts: 2Member
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, FlPosts: 26Member
    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, FlPosts: 26Member
    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.