The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Objective C Code
Posted by: panda1 | December 22, 2010 @ 1:32pm
Objective C Code
[
Download
]
float circleArea(float theRadius); float pictureSurfaceArea(float pictureWidth, float pictureHeight); int main(int argc, const char * argv[]) // the argument inside main() is to do with memory allocation { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; //memory allocation float circleRadius, circleSurfaceArea, pictureWidth, pictureHeight, pictureArea; pictureWidth = 8.0; pictureHeight = 4.0; circleRadius = 5.0; pictureArea = pictureSurfaceArea(pictureWidth, pictureHeight); circleSurfaceArea = circleArea(circleRadius); NSLog(@" The area of the circle is %.2fcm.", circleSurfaceArea); NSLog(@" However the area of my picture is %.0fcm.", pictureArea); [pool drain]; //memory clean up return 0; } //circle area algorithm float circleArea(float theRadius) { float theArea; theArea = 3.1416 * theRadius * theRadius; return theArea; } // picture area algorithm float pictureSurfaceArea(float pictureWidth, float pictureHeight) { float pictureSpace; pictureSpace = pictureWidth * pictureHeight; return pictureSpace; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.44 / 8
68 Votes
http://codebin.yi.org/1028
page generated in 0.00 seconds