Divide contents of Arrays?!?
Ok this might be hard to follow. Basically im trying to divide two array objects (from different arrays) and get a integer out of it. But it would add the first array contents together first, then divide by 1 object in the second array. Ex: array1:5,10 array2:10,20.
int = [array1 totalof objects / array2 objectatindex:0]
so int would = 1.5 in this case
can int even be a decimal? would it use double? Im lost. Heres my terrible convoluted code:
Anyone got any ideas? Help would be AWESOME! Thanks!!!
int sum=0;
for(int x=0; x < [delegate.actsections count]; x++)
{
sum += [[delegate.actsections objectAtIndex:x] intValue];
}
int *percentagebar;
percentagebar = [[NSString stringWithFormat:@"%d", sum] intValue];
int *percentagebar2;
percentagebar2 = [[[delegate capitals] objectAtIndex:0] intValue];
int *percentagebar3;
percentagebar3 = percentagebar/percentagebar2;
if (percentagebar3 = 1) {
[percentage replaceObjectAtIndex:0 withObject:@"costbarfull50.png"];
}
|