Sum the array values

In reply to kddholak:

Ya i have gone through the array manipulation methods.It helps me.
But i am stuck with descending order it.
I just came to know i have to use rsort()
But don"t know how to proceed.

Here is my code

module data;
typedef struct {
int english,maths,science;
string name;
} mark_t;
mark_t sheet ;
mark_t q[]; mark_t result[];
int total;
int i;
initial begin
q=‘{’{50,60,80,“john”},‘{60,70,50,“peter”},’{70,60,90,“nathan”}};
$display(“student list =%p”,q);

foreach(q[i]) begin 
    total = q.sum with ( item.index == i ? item.english + item.maths + item.science : 0);   

  if(total > 200) begin 

      $display("%p",q[i]);
    
    result = q.find with ( item.english >= 60 && item.maths >= 60);
    $display(" above 60 in english,maths=%p",result);
    
    result=q.find with (item.english>item.maths);
    $display ("more marks in english=%p",result);
    
    result=q.find_first with (item.english>50);
    $display("english more than 50=%p",result);
    
   **foreach(q[i])begin
      q[i].rsort();** //How to do descending??
      
    end
      
    
    end
end

end
endmodule