tify">}
(IBAction) changeGreeting: (id) sender {* str=self.textField.text; (test_to_bin (return_only_number (str))) {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, binary_to_decimal (str)];
}. label.text=[[NSString alloc] initWithFormat: @ Input only: 0,1 ];
}
(IBAction) BintoOct: (id) sender {* str=self.textField.text; (test_to_bin (return_only_number (str))) {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, binary_to_octal (str)];
}. label.text=[[NSString alloc] initWithFormat: @ Input only: 0,1 ];
}
(IBAction) BintoHex: (id) sender {* str=self.textField.text; (test_to_bin (return_only_number (str))) {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, binary_to_hex (str)];
}. label.text=[[NSString alloc] initWithFormat: @ Input only: 0,1 ];
}
(IBAction) OcttoBin: (id) sender {* str=self.textField.text; (test_to_octal (return_only_number (str))) {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, octal_to_binary (str)];
}. label.text=[[NSString alloc] initWithFormat: @ Input only: 0,1,2,3,4,5,6,7 ];
}
(IBAction) OcttoDec: (id) sender {* str=self.textField.text; (test_to_octal (return_only_number (str))) {.label.text=[[NSString alloc] initWithFormat: @ % @ , binary_to_decimal (octal_to_binary (str))];
}. label.text=[[NSString alloc] initWithFormat: @ Input only: 0,1,2,3,4,5,6,7 ];
}
(IBAction) OcttoHex: (id) sender {* str=self.textField.text; (test_to_octal (return_only_number (str))) {.label.text=[[NSString alloc] initWithFormat: @ % @ , binary_to_hex (octal_to_binary (str))];
}. label.text=[[NSString alloc] initWithFormat: @ Input only: 0,1,2,3,4,5,6,7 ];
}
(IBAction) DectoBin: (id) sender {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, decimal_to_binary (return_only_number (self.textField.text))] ;
}
(IBAction) DectoOct: (id) sender {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, decimal_to_octal (return_only_number (self.textField.text))] ;
}
(IBAction) DectoHex: (id) sender {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, decimal_to_hex (return_only_number (self.textField.text))] ;
}
(IBAction) HextoBin: (id) sender {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, hex_to_bin (return_hex (self.textField.text))] ;
}
(IBAction) HextoOct: (id) sender {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, binary_to_octal (hex_to_bin (return_hex (self.textField.text) ))];
}
(IBAction) HextoDec: (id) sender {.label.text=[[NSString alloc] initWithFormat: @ % @ raquo ;, binary_to_decimal (hex_to_bin (return_hex (self.textField.text) ))];
}
(BOOL) textFieldShouldReturn: (UITextField *) theTextField {(theTextField == self.textField) {
[theTextField resignFirstResponder];
} YES;
} * binary_to_decimal (NSString * str) {num=0; k=0; * str_number; (k=0; (k + 1) lt;=[str length]; k ++) {+ =[[str substringWithRange: NSMakeRange (k, 1)] intValue] * pow (2, [str length] - (k + 1));
} str_number=[NSString stringWithFormat: @ % d raquo ;, num] ;;
} * binary_to_octal (NSString * str) {= [NSString stringWithFormat: @ % o raquo ;, [binary_to_decimal (str) integerValue]]; str;
} * binary_to_hex (NSString * str) {= [NSString stringWithFormat: @ 0x% X raquo ;, [binary_to_decimal (str) integerValue]]; str;
} * octal_to_binary (NSString * str) {* outputstring;=@ raquo ;; (int k=0; k lt; [str length]; k ++) {([[str substringWithRange: NSMakeRange (k, 1)] intValue]) {0:=[NSString stringWithFormat: @ % @ 000 raquo ;, outputstring] ;; 1:=[NSString stringWithFormat: @ % @ 001 raquo ;, outputstring] ;; 2: =[NSString stringWithFormat: @ % @ 010 raquo ;, outputstring] ;; 3:=[NSString stringWithFormat: @ % @ 011 raquo ;, outputstring] ;; 4:=[NSString stringWithFormat: @ % @ 100 , outputstring] ;; 5:=[NSString stringWithFormat: @ % @ 101 raquo ;, outputstring] ;; 6:=[NSString stringWithFormat: @ % @ 110 raquo ;, outputstring] ;; 7:=[NSString stringWithFormat: @ % @ 111 raquo ;, outputstring] ;;:;
}