cebasso
asked on
Mathematical Logic
Hello,
In an array, for every 4 elements i have a new member information, example
If my array has only one member, will be something like...
array[0] = "some value";
array[1] = "some value";
array[2] = "some value";
array[3] = "some value";
if my array has two members, will be like
array[0] = "some value";
array[1] = "some value";
array[2] = "some value";
array[3] = "some value";
array[4] = "some value"; //here start a new member info
array[5] = "some value";
array[6] = "some value";
array[7] = "some value";
if i need to know, how many members the array is holding...
(count(array) / 4); //4 = number of elements for each member
Ok, now if i need to loop through members and display each member info?
for (i=0;i<(count(array) / 4);i++)
{
//here how to step and display each member info separated member by member?
}
its not oriented to any language, doesnt matter if you program in C++, Delphi, Java, PHP, etc... will be the same logic hehe
can you help me?
regards!
In an array, for every 4 elements i have a new member information, example
If my array has only one member, will be something like...
array[0] = "some value";
array[1] = "some value";
array[2] = "some value";
array[3] = "some value";
if my array has two members, will be like
array[0] = "some value";
array[1] = "some value";
array[2] = "some value";
array[3] = "some value";
array[4] = "some value"; //here start a new member info
array[5] = "some value";
array[6] = "some value";
array[7] = "some value";
if i need to know, how many members the array is holding...
(count(array) / 4); //4 = number of elements for each member
Ok, now if i need to loop through members and display each member info?
for (i=0;i<(count(array) / 4);i++)
{
//here how to step and display each member info separated member by member?
}
its not oriented to any language, doesnt matter if you program in C++, Delphi, Java, PHP, etc... will be the same logic hehe
can you help me?
regards!
Rather than an array like that why not use a collection of classes?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"its not oriented to any language, doesnt matter if you program in C++, Delphi, Java, PHP, etc... will be the same logic"
ASKER
@Neilsr exaclty, but i mean about the logic, simple and pure... as strickdd did [i*4 +1], etc...
ASKER
Perfect! thank you!
The logic is that as a programmer you would not use a linear array to hold a collection of related data. It is as poor and lazy as it gets in terms of development.