Fortran 77

Discussion in 'Programmer's Corner' started by braddy, Apr 22, 2006.

  1. braddy

    Thread Starter Well-Known Member

    Dec 29, 2004
    Hi , I need help to write a code for this function(fortran 77):

    integer function delete(id, list, n) where
    • delete returns 0 if the deletion was successful, -1 if the list is empty, and -2 if the user is not currently in the list.
    •id is the integer identification number of the user.
    •list is the integer array from which the id is to be removed.
    •n is the current length of the list.

    I tried this:
    Code ( (Unknown Language)):
    2.   integer function delete(id,list,n)
    3.    integer i,indexe,j
    4.    do 20 i=1,n
    5.    if(list(i) then
    6.      indexe=i
    8. 20  continue
    9.      do 30 j= indexe,n
    10.      list(i) = list(i+1)
    11. 30    continue
    12.    n = n-1
    13.    return 0
    I have not finfished because I am stuck . I dont know where to introduce the else statement that would indicat the id is not in the list.
    My second problem is that How to check if that array is empty?

    please can someone help me?
    Thank you for the time.