discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Obtaining float values from Array


From: Jeric Batarina
Subject: Obtaining float values from Array
Date: Sun, 6 Feb 2011 02:03:58 +0800

I want to get the average of the numbers in my array. So how can I get those values and turn them back into floats??

Code(I'm not sure if I used the right ones):

  ....
                  
  for(x=0;x<=[storage count];x++){                       
            sumOfArray= sumOfArray+[NSNumber [storage objectAtIndex:x]]; //Problem here. I'm trying to get the float values in the Array.
   }
                       
    averageOfArray=sumOfArray/[storage count];
    printf("Average: %f",averageOfArray);
    break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]