I've been reading this book and am having trouble with one of the sample codes that the author calls "bool party". I keep getting error when i try to "build and run". I've typed the code exactly as it appears in the book but i can't get it to work. Anyone familiar with this title? "learning objective c on the mac"
thank you
thank you
Code:
#import <Foundation/Foundation.h>
//returns NO if the two integers have the same
//value, YES otherwise
BOOL areIntsDifferent (int thing1, int thing2)
{
if (thing1== thing2) {return(NO);}else {return (YES);}
}//areIntsDifferent
//given a NO value, return the human-readable
// strin "NO". Otherwise return "YES"
NSString *boolString (BOOL yesno)
{
if (yesNo == NO) {return (@"NO");} else { return (@"YES"); [I]Here I get "yesNo undeclared"[/I]
}
// boolstring
int main (int argc, const char *argv[])[I] here I get "nested functions are disabled use fnested functions[/I]
{
BOOL areTheyDifferent; areTheyDifferent = areIntsDifferent (5, 5);
NSLog (@"are %d and %d different? %@", 5, 5, boolString(areTheyDifferent));
areTheyDifferent = areIntsdifferent (23, 42); [I]Here I get "Implicit declaration of function"[/I]
NSLog (@"are %d and %d different? %@", 23, 42, boolString(areTheyDifferent));
return(0)
;} //main [I]Expected declaration of input"[/I]