Home > Software engineering >  Delete the VB - cycle is zero or negative element in the array
Delete the VB - cycle is zero or negative element in the array

Time:10-14

I wrote a VB program need to delete the zero or negative element in the array, the structure of the whole program is roughly as follows:
For number=nmin To nmax
'the first paragraph
For j=1 To popsize
For I=1 To number
Q (j, I)=...
Next I
Next j
. 'other operating
'the second paragraph
For I=1 To number
The Write # 1, q (j, I)=...
Next I
Next number

All variables have been defined, and now I need the first cycle will be an array of q (number) is zero or negative element in the delete, get the new array as a result of the output, but after removing elements changes in the size of the number, it will affect the outermost loop, so struggling with removing elements should be done in the first section of the program, this is the first section of the program after the completion, o master, gives the specific procedures, thank you very much,

CodePudding user response:

Reverse order to delete...

CodePudding user response:

Specifically, at the end of the first section of the program, delete negative or zero elements in reverse chronological order? Will changes in the number of the outermost layer For number=nmin To have influence on the cycle nmax? thank you

CodePudding user response:

Sorry, wrong thought is one-dimensional,
How can any two-dimensional array delete one of the elements?

CodePudding user response:

Your program has a problem, the second paragraph of q is the j (j, I) fixed?

CodePudding user response:

Two-dimensional bad to delete,
A one-dimensional reverse order to delete,

CodePudding user response:

reference 5 floor chuifengde reply:
your program has a problem, the second paragraph of q is the j (j, I) fixed?
I'm sorry, just throw the wrong tickets,
There are next j, outer circulation has been omitted, well, thank you for your reply oh,

CodePudding user response:

People think don't delete, define a data structure, a Boolean type, said data is valid, if the data is integer is set to True, otherwise set to False, then use a For loop to check this property, and to establish an array, the True attribute data, in turn, can be deposited in the array,

CodePudding user response:

Don't even need additional data structures, since less than or equal to 0 data is invalid, will these values as NULL to handle is ok,
  • Related