美文网首页
【练习】BOOL类型 练习

【练习】BOOL类型 练习

作者: AmberAlbee | 来源:发表于2018-07-19 22:28 被阅读0次

#import

//returns NO if the two integers have the same

//value, YES therwise

BOOLareIntsDifferent (intthing1,intthing2)

{

    if(thing1 == thing2)

    {

        return(NO);

    }

    else{

        return(YES);

    }

} //areIntsDifferent

//given a NO valuem return the human-readable

//string "NO". Otherwise return "YES"

NSString*boolString (BOOLyesNO)

{

    if(yesNO ==NO)

    {

        return(@"NO");

    }

    else

    {

        return(@"YES");

    }

} //boolString

intmain(intargc,constchar* argv[]) {

    BOOLareTheyDifferent;

    areTheyDifferent =areIntsDifferent(5,5);

    NSLog(@"are %d and %d different? %@", 5,5, boolString(areTheyDifferent));

    areTheyDifferent =areIntsDifferent(23,42);

    NSLog(@"are %d and %d different? %@", 23,42, boolString(areTheyDifferent));

    return(0);

}

相关文章

  • 【练习】BOOL类型 练习

    #import //returns NO if the two integers have the same //...

  • Bool类型

    C语言和OC并没有真正的Bool类型C语言的Bool类型非0即真OC语言的Bool类型是typedef signe...

  • 刻意练习

    刻意练习是什么? 刻意练习指的是一种有目的、有系统的特殊类型的练习。区别于常规练习即盲目地重复。 刻意练习的原理:...

  • NSuserDefaults存储

    不能存储自定义类型、bool类型bool类型需要转换一下

  • V语言学习笔记-02基本类型

    布尔类型 bool bool类型的值只能是true或false bool类型从定义的C代码看,是C的一个int类型...

  • iOS bool类型

    2016.12.6 0代表no 1代表yes 默认是no

  • 布尔类型(bool)

    转载须注明出处:简书@Orca_J35 | GitHub@orca-j35,所有笔记均托管于 python_not...

  • 日常算法练习(二) Leetcode

    前言 这次算法练习是数组类型简单练习,以后LeetCode的练习会根据不同tags进行展开,先easy再到medi...

  • day04-循环和分之结构

    01-if语句 4.if语句可以嵌套使用 练习 5.判断数据的类型 练习:计算1+2+3+...+100 练习:只...

  • 4.Python基础数据类型之bool

    Python基础数据类型之bool bool(布尔值)bool() 函数用于将给定参数转换为布尔类型,如果没有参数...

网友评论

      本文标题:【练习】BOOL类型 练习

      本文链接:https://www.haomeiwen.com/subject/ghpxmftx.html