Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Simple Arithmetic Operations in Objective C
//gcc 5.0.4 #import <Foundation/Foundation.h> @interface FrstCode:NSObject - (void)add; - (void)sub; - (void)mul; - (void)div; @end @implementation FrstCode float a=10.23, b=20.14, c; - (void)add { c = a + b; NSLog(@"%f + %f = %f",a,b,c); } - (void)sub { c = a - b; NSLog(@"%f - %f = %f",a,b,c); } - (void)mul { c = a * b; NSLog(@"%f * %f = %f",a,b,c); } - (void)div { c = a / b; NSLog(@"%f / %f = %f",a,b,c); } @end int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //NSLog (@"Hello, World!"); FrstCode *frstCode = [[FrstCode alloc]init]; [frstCode add]; [frstCode sub]; [frstCode mul]; [frstCode div]; return 0; }
run
|
edit
|
history
|
help
0
Goldbach Conjecture
Obj C Program Structure
Strings
Func Var and Ops ObjC
objective c fibonanci
string replace
NSString & MutableNSString Examples in one
02 Mostrar valor de variable entera
size of datatypes in objective c
change case