6
Duplicar posible:
Is there a convenient function in objective-c/coca-touch to find a lowest number?función predefinida para un mínimo
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int a=10,b=5,c;
c=min(a,b);
NSLog(@"min:%d",c);
[pool drain];
return 0;
}
tengo que calcular el valor mínimo de dos números. Podemos usar if (a> b) para conocer el valor mínimo. Pero hay alguna función predefinida para calcular el mínimo de dos números.
http://stackoverflow.com/questions/2125126/how-would-you-define-a-simple-min-method-in-obj-c duplicado exacto – Kevin
También eche un vistazo a http: // stackoverflow. com/questions/844990/y lee la respuesta sobre 'math.h'. – rid