Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-18-2009, 08:15 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 157
Default 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"];
}
starwarsdevwookie59 is offline   Reply With Quote
Reply

Bookmarks

Tags
array, divide

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 339
20 members and 319 guests
ADY, Dani77, e2applets, Herbie, JasonR, keeshux, linkmx, mer10, Monstertaco, piesia, prchn4christ, Promo Dispenser, Robiwan, sebasx, sly24, Touchmint, twerner, zulfishah
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,760
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:33 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0