C
cdg
Could anyone tell me how to write a loop for an array, that would have to
check each iteration for duplications of previous entered values. So, the
exact number of loops is not known, but the total number of array elments is
known.
Example: array size - array[100]
(some type of loop statement)
{
array[n] "equal to" or "not equal to" a variable. If not a duplication,
increase the count by one. If it is a duplication, check the next variable
for duplication and so on.
}
This is only approach I have tried, but it is not working.
while(i<100)
{
ct += 1;
"statements"
for(n=0; n<ct; n++)
{
array[n] != var.name ? array[n] == var.name : n--
}
}
check each iteration for duplications of previous entered values. So, the
exact number of loops is not known, but the total number of array elments is
known.
Example: array size - array[100]
(some type of loop statement)
{
array[n] "equal to" or "not equal to" a variable. If not a duplication,
increase the count by one. If it is a duplication, check the next variable
for duplication and so on.
}
This is only approach I have tried, but it is not working.
while(i<100)
{
ct += 1;
"statements"
for(n=0; n<ct; n++)
{
array[n] != var.name ? array[n] == var.name : n--
}
}