ZoranSRB17
ZoranSRB17

Reputation: 5

Syntax error, ";" expected but identifier OBRADA" found, error in function but don't understand why

Syntax error, ";" expected but identifier OBRADA" found, error in function but don't understand why.. How come only happens to the second function but not in the first ? And could someone tell me if I used Delete correctly in this code ?

I had to make a program that counts integers in a string, and if 2 integers are the same remove all the duplicates of that integer. Write the new string, and the number of duplicate that has appeared most times... Could I have done it possibly easier then this ? Thanks in advance !

Program Zad_Septembar1_2013;

Const
  max = 100;

Type
  niz = array[1..100] Of integer;

Var A: niz;

Function citaj(Var A:niz;Var n:integer): boolean;
Var
  i: integer;
Begin
  citaj := true;
  writeln('Unesite duzinu niza');
  readln(n);

  If (n>0) And (n<=max) Then
    Begin
      For i:=1 To n Do
        Begin
          writeln('Unesite', i ,'. cifru');
          readln(A[i]);
        End     ;
    End;

  Function obrada(Var A:niz; Var n,q,s:integer): integer;
  {Here I get an error but i don't understand why}
  Var
    p,m,i: integer;
  Begin
    m := 0;
    q := 0;
    p := 0;
    s := 0;
    For i:=1 To n Do
      Begin
        p = A[i];

        For i:=1 To n Do
          Begin
            If (A[i]=p) Then
              Begin
                m := m+1;
                Delete(A[i]); {Did i use delete correctly ?}

              End;
          End;

        If (m>s) Then
          Begin
            s := m;
            q := p;
          End;
      End;
  End;

  Procedure ispis(Var A:niz; q,s:integer);
  Var
    g: integer;
  Begin
    g := length( A );

    For i:=1 To go Do
      write(A[i]);

    writeln('Broj pojavljivanja u nizu je: ',s);
    writeln('Broj koji se pojavljuje je:', q);

Upvotes: 0

Views: 1501

Answers (1)

No&#39;am Newman
No&#39;am Newman

Reputation: 6477

Apart from the missing 'end' at the end of 'citaj', you also appear to have an undeclared identifier in this statement For i:=1 To go Do... Using more descriptive variable names would help immensely.

Upvotes: 1

Related Questions