//
// main.m
// HeloObjectiveC
//
// Created by wb on 14-9-13.
// Copyright (c) 2014年 wb. All rights reserved.
//
#import <Foundation/Foundation.h>
BOOL areIntsDifferent ( int thing1, int thing2) //
{
if (thing1==thing2)
{
return (NO);
}
else
return (YES);
}
NSString *Boolstring(BOOL yesno) // 字符型声明前面有*,表示字符串属于指针类型,char类型相同,赋值时使用@表示地址指针调用
{
if (yesno==NO)
{
return ( @" NO ");
}
else
{
return ( @" Yes ");
}
}
int main( int argc, const char * argv[])
{
BOOL areTheDifferent; //BOOL类型,值为YES和NO,不能用数值来表示
areTheDifferent=areIntsDifferent ( 5, 5);
NSLog( @" are %d and %d different? %@ " , 5, 5,Boolstring(areTheDifferent)); //格式化数字%d ,格式化文本%@
areTheDifferent=areIntsDifferent ( 23, 42);
NSLog ( @" are %d and %d different? %@ " , 23, 42,Boolstring(areTheDifferent));
return 0;
}
// main.m
// HeloObjectiveC
//
// Created by wb on 14-9-13.
// Copyright (c) 2014年 wb. All rights reserved.
//
#import <Foundation/Foundation.h>
BOOL areIntsDifferent ( int thing1, int thing2) //
{
if (thing1==thing2)
{
return (NO);
}
else
return (YES);
}
NSString *Boolstring(BOOL yesno) // 字符型声明前面有*,表示字符串属于指针类型,char类型相同,赋值时使用@表示地址指针调用
{
if (yesno==NO)
{
return ( @" NO ");
}
else
{
return ( @" Yes ");
}
}
int main( int argc, const char * argv[])
{
BOOL areTheDifferent; //BOOL类型,值为YES和NO,不能用数值来表示
areTheDifferent=areIntsDifferent ( 5, 5);
NSLog( @" are %d and %d different? %@ " , 5, 5,Boolstring(areTheDifferent)); //格式化数字%d ,格式化文本%@
areTheDifferent=areIntsDifferent ( 23, 42);
NSLog ( @" are %d and %d different? %@ " , 23, 42,Boolstring(areTheDifferent));
return 0;
}