Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 1.72 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. temperature converter not giving output
  2. #import <UIKit/UIKit.h>
  3.  
  4. float n ;
  5. float k;
  6.  
  7.  
  8.  
  9. @interface farh_celcius_conv_AppDelegate : NSObject <UIApplicationDelegate> {
  10.     UIWindow *window;
  11.     UILabel *display;
  12.     IBOutlet UITextField *farhenite;
  13.     IBOutlet UIButton *convert;
  14.  
  15. }
  16.  
  17.  
  18. -(IBAction) convert;
  19.  
  20.  
  21. @property (nonatomic, retain) IBOutlet UIWindow *window;
  22. @property (nonatomic, retain) IBOutlet UILabel *display;
  23. @property (nonatomic, retain) IBOutlet UITextField *farhenite;
  24. @property (nonatomic, retain) IBOutlet UIButton *convert;
  25. @end
  26.        
  27. #import "farh_celcius_conv_AppDelegate.h"
  28.  
  29.  
  30. @implementation farh_celcius_conv_AppDelegate
  31.  
  32.  
  33. @synthesize window,display,farhenite;
  34.  
  35.  
  36.  
  37.  
  38.  
  39. -(IBAction) convert  {
  40.  
  41.     NSString *str = [NSString text];
  42.  
  43.     float n = [str floatValue];
  44.  
  45.  
  46.       k = (n - 32)*(5/9);
  47.  
  48.  
  49.  
  50.     [display setText:[NSString stringWithFormat:@"%f",k]];  
  51.  
  52. }
  53.  
  54. - (void)applicationDidFinishLaunching:(UIApplication *)application {    
  55.  
  56.     // Override point for customization after application launch
  57.     [window makeKeyAndVisible];
  58. }
  59.  
  60.  
  61. - (void)dealloc {
  62.     [window release];
  63.     [super dealloc];
  64. }
  65.  
  66.  
  67. @end
  68.        
  69. -(IBAction) convert  {
  70.  
  71.     NSString *str = yourTextField.text; // In your case farhenite i guess
  72.  
  73.     float n = [str floatValue];
  74.  
  75.  
  76.       k = (n - 32)*(5/9);
  77.  
  78.  
  79.  
  80.     [display setText:[NSString stringWithFormat:@"%f",k]];  
  81.  
  82. }
  83.        
  84. NSString *str = textField.text;
  85.        
  86. NSString *str = display.text;
  87.  
  88. float n = [str floatValue];
  89.  
  90.  
  91.   k = (n - 32)*(5/9);
  92.  
  93.  
  94.  
  95. [display setText:[NSString stringWithFormat:@"%f",k]];
  96.        
  97. -(IBAction) convert  {
  98.  
  99.     NSString *str = farhenite.text;
  100.  
  101.     float n = [str floatValue];
  102.  
  103.  
  104.       k = (n - 32)*(5/9);
  105.  
  106.  
  107.  
  108.     [display setText:[NSString stringWithFormat:@"%f",k]];  
  109.  
  110. }
  111.        
  112. NSString *str = display.text;