Re: Why does it run so long?





Ed Prochak wrote:
> Michael wrote:
>
>>Hi.
>>
>>Here is my codes, which run too long. It takes about 8 minutes to complete
>>the "for" loop. Why does it run so long? What's wrong?
>>
>>Thanks for any help.
>>
>>Yours sincerely,
>>
>>Michael
>>
>>P.S.:
>>for(i=1; i<=30; i++)
>>{
>>mark:
>>for(j=1; j<=100; j++) x[j]=Random();//Random() will generate a value between
>>0 and 1;
>>if(check(x)==0) goto mark;
>>for(j=1; j<=100; j++) A[i][j]=x[j];
>
> this loop runs 100 times inside a loop that runs 100times,

No; you've got the nesting wrong. (The shoddy
formatting of the code is at least partly to blame.)

--
Eric.Sosman@xxxxxxx

.



Relevant Pages

  • Re: Why does it run so long?
    ... Michael wrote: ... > Here is my codes, ... > the "for" loop. ... Why do you use a goto? ...
    (comp.lang.c)
  • Re: Why does it run so long?
    ... Michael wrote: ... Here is my codes, which run too long. ... the "for" loop. ... an incomplete diagnosis is possible. ...
    (comp.lang.c)
  • Re: Why does it run so long?
    ... Michael wrote: ... > Here is my codes, ... > the "for" loop. ... you're doing DOUBLE floating point arithmetic in nested loops that I ...
    (comp.lang.c)
  • Re: Terminating a running Loop in GUI!
    ... I am having a problem in GUI. ... in the opening function of your gui, set some flag ... getting the handles structure in the loop might not ...
    (comp.soft-sys.matlab)
  • Re: Searching into Non-Contiguous ranges in a columns
    ... slr = Cells.End.Row ... Set r = .Cells ... Loop While Not c Is Nothing And c.Address firstAddress ... I know my codes are from A5 to A635. ...
    (microsoft.public.excel.programming)