Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#9876 Help Me ! » Programming Error!!! » 2011-09-22 08:36:39

anonimnystefy
Replies: 3

hi guys

i've been doing my programming homework and i got an error,but don't know where's the problem.

here's the code.it's Pascal and written in Lazarus v0.9.28.2 beta:

program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };

const
  k=100;

type
  niz=array[1..k] of real;
  matrica=array[1..k] of niz;

var
  a:matrica;
  n,i,j:integer;

procedure exchange(x,y:real);
var p:real;
begin
  p:=x;
  x:=y;
  y:=p;
end;

procedure QuickSort(var a:matrica;var b:niz;levi,desni,n:integer);
var
  i,j,k:integer;
  D:real;
begin
  if levi<desni then
  begin
    i:=levi;
    j:=desni;
    D:=b[desni];
    repeat
      while b[i]<D do
        i:=i+1;
      while (b[j]>=D) and (i<j) do
        j:=j-1;
      if i<j then
      begin
        exchange(b[i],b[j]);
        for k:=1 to n do
          exchange(a[i][k],a[j][k]);
      end;
    until i=j;
    exchange(b[i],b[desni]);
    QuickSort(a,b,levi,i-1,n);
    QuickSort(a,b,i+1,desni,n);
  end;
end;

procedure GrowingRows(var a:matrica;n:integer);
var
  b:niz;
  i:integer;
begin
  for i:=1 to n do
    ------------b[i]=a[i][1];------------
  QuickSort(a,b,1,n,n);
end;

begin
  write('Enter the number of rows of the square matrix: ');
  readln(n);
  for i:=1 to n do
    begin
      for j:=1 to n do
        read(a[i][j]);
      readln;
    end;
  GrowingRows(a,n);
  for i:=1 to n do
    for j:=1 to n do
      write(a[i][j]);
  readln;
end.

i have marked the line in problem and the error message says:'Error: Illegal expression' what

#9877 Re: Jokes » Random jokes I come across » 2011-09-21 08:30:50

well,i think it was meant for student cases,and it means that students don't really check the solutions and/or examples given by work or any sheets for that matter.

#9878 Re: Jai Ganesh's Puzzles » General Quiz » 2011-09-18 23:18:11

hi bobbym

that picture is disgusting.

hi ganesh

i have heard of both but don't know who wrote them. sad

#9879 Re: Help Me ! » Equations with parenthesis? » 2011-09-18 10:11:57

i know that we were a province,but not sure 'bout the emperors.

yes,Yugoslavia,but it fell apart and now Croatia and Serbia hate each others guts!

#9881 Re: Help Me ! » Equations with parenthesis? » 2011-09-18 09:57:39

yes i know.i hear that in america they don't care that much about history.

we were in the First and Second World War,but i don't know how known that fact is.

we were under the Turks for around 500 years.

#9883 Re: Help Me ! » Equations with parenthesis? » 2011-09-18 09:42:16

it's not unknown,it's just not that known either.

#9884 Re: Help Me ! » Equations with parenthesis? » 2011-09-18 09:38:33

yup.we are somewhat aware of that.but it's okay.

#9885 Re: Guestbook » How old are you bobbym? » 2011-09-18 09:35:38

hi Sarah.

how are you.has your period passed?

#9886 Re: Guestbook » How old are you bobbym? » 2011-09-18 09:25:10

to you,bobz roflol

bobbym=bobz.get used to it.

#9887 Re: Help Me ! » Equations with parenthesis? » 2011-09-18 09:23:31

i think that Serbia is not a well-known country,and so do all Serbian people.

#9888 Re: Help Me ! » Equations with parenthesis? » 2011-09-18 09:18:49

i get surprised when people from other countries that are far enough know where Serbia is.

#9889 Re: Guestbook » How old are you bobbym? » 2011-09-18 09:17:14

hi bobz

you changed your avatar again.this is one is nicer than the last one! smile

#9890 Re: Guestbook » How old are you bobbym? » 2011-09-16 23:44:39

hi Sarah

"do you have a wife?"

what the...? i'm 14.

#9892 Re: Guestbook » How old are you bobbym? » 2011-09-16 05:31:01

that's good.fortunately (and unfortunately), it's only once a month or so.

anyway,it's better than if it skips,because it means a whole other and worse thing.

#9893 Re: Help Me ! » Equations with parenthesis? » 2011-09-16 05:27:25

he won't.he's mean and sarcastic on the outside,but he has a kind heart.

#9894 Re: Guestbook » How old are you bobbym? » 2011-09-16 05:24:47

hi Sarah

how's the cramping,and the...?

#9895 Re: Exercises » Series » 2011-09-16 04:42:35

where can i find it?

#9896 Re: Exercises » Series » 2011-09-15 09:22:07

i don't know any of that stuff.what about 19?

#9898 Re: Exercises » Series » 2011-09-15 09:13:17

anyone know how to do these?

#9899 Re: Exercises » Limits! » 2011-09-15 09:02:07

yes i have noticed that,and i was about to ask why.i hope that too.

well anyone can provide if they can find them.

#9900 Re: Guestbook » How old are you bobbym? » 2011-09-15 09:00:55

I am not getting older,I'm just not getting younger!

Board footer

Powered by FluxBB