I am working on the book "Programming in the lens with 2.0", and I do not understand why this program does not work. basically i need to build a program to convert fahrenheit to celcius.
I decided to just solve it very simply without objects and just use a straightforward procedural methodology, since the problem I am facing is that the values of the variables that I define to represent the values in Fahrenheit or Cellus are random.
Here is my code:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
float fahrenheit;
float celciusConverted;
fahrenheit = 27.0;
celciusConverted = ( fahrenheit - 32 ) / 1.8 ;
NSLog(@"%f degrees fahrenheit is equal to %f degrees celcius") , fahrenheit, celciusConverted;
[pool drain];
return 0;
}
source
share