C++实操 - True and false
#include <stdio.h>
int main()
{_Bool varA;varA = 2;printf("varA:%d.\n",varA);varA = -1;printf("varA:%d.\n",varA);varA = 0;printf("varA:%d.\n",varA);printf("Hello world!\n");return 0;
}$ gcc -o tof tof.c
$ ./tof
varA:1.
varA:1.
varA:0.
Hello world!
/* Copyright (C) 1998, 1999, 2000, 2009 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<Licenses- GNU Project - Free Software Foundation>. */
/*
* ISO C Standard: 7.16 Boolean type and values <stdbool.h>
*/
#ifndef _STDBOOL_H
#define _STDBOOL_H
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#else /* __cplusplus */
/* Supporting <stdbool.h> in C++ is a GCC extension. */
#define _Bool bool
#define bool bool
#define false false
#define true true
#endif /* __cplusplus */
/* Signal that all the definitions are present. */
#define __bool_true_false_are_defined 1
#endif /* stdbool.h */
#include <stdio.h>
#include <stdbool.h>
int main()
{bool varA;varA = 2;printf("varA:%d.\n",varA);varA = -1;printf("varA:%d.\n",varA);varA = 0;printf("varA:%d.\n",varA);varA = true;printf("varA:%d.\n",varA);varA = false;printf("varA:%d.\n",varA);printf("Hello world!\n");return 0;
}$ gcc -o tof tof.c
$ ./tof
varA:1.
varA:1.
varA:0.
varA:1.
varA:0.
Hello world!
#include <stdio.h>
int main()
{bool varA;printf("false:%d,true:%d.\n", false, true);varA = 2;printf("varA:%d.\n", varA);varA = -1;printf("varA:%d.\n", varA);varA = 0;printf("varA:%d.\n", varA);printf("Hello world!\n");return 0;
}$ g++ -o tofplus tof.cpp
$ ./tofplus
false:0,true:1.
varA:1.
varA:1.
varA:0.
Hello world!
C++实操 - True and false相关推荐
- 完整代码+实操!手把手教你操作Faster R-CNN和Mask R-CNN
点击上方↑↑↑蓝字关注我们~ 「2019 Python开发者日」全日程揭晓,请扫码咨询 ↑↑↑ 机器视觉领域的核心问题之一就是目标检测(Object Detection),它的任务是找出图像当中所有感 ...
- 实操教程|PyTorch AutoGrad C++层实现
点击上方"视学算法",选择加"星标"或"置顶" 重磅干货,第一时间送达 作者丨xxy-zhihu@知乎 来源丨https://zhuanla ...
- Java网络爬虫实操(5)
上一篇:Java网络爬虫实操(4) 大家好,前几篇文章介绍的URL都是返回HTML内容的,然后再从HTML字符串里解析出我们想要的数据. 但是,随着前端编程技术的发展,至少十多年前开始ajax.jso ...
- supervisor 守护多个进程_supervisor守护进程管理实操笔记
2020年年后工作中需开发一支持多数据源自动上报业务数据的程序,程序开发完部署上线时需要对其进程进行自动管理,不然哪天程序down了还不知,可就麻烦了,所以这里选用了强大的supervisor,以下文 ...
- python判断素数的函数_Python素数prime函数练习_Python源码实操
Python素数prime函数练习_Python源码实操 素数prime函数练习 1) 写一个函数isprime(x) 判断x是否为素数,如果是素数,返回True,否则返回False def ispr ...
- Java网络爬虫实操(3)
上一篇:Java网络爬虫实操(2) 本篇文章主要介绍NetDiscovery框架中pipeline模式的一些实际使用方法. 1) 什么是pipeline pipeline是一种常见的算法模式,针对不断 ...
- 3-8 基于SpringBoot连接数据库与配置MyBatis实操 创建表sql
11 13-8 基于SpringBoot连接数据库与配置MyBatis实操 springSecurity提供了 现成的基于内存管理的类 shiro则必须自 ...
- python三维图能画地图_Python地图绘制实操详解
网上有很多地图绘制的教程,更多趋向于全国地图或者省级地图,但有时我们需要到县级.闲得慌,今天以贵州省毕节市为例,分享一篇Python县级地图的绘制(遥想当时差点把百度翻了个底朝天),希望对需要的你能有 ...
- datagridview 绑定list 不能刷新界面_人人都可写代码-H5零基础编程-发布活动界面实操07...
欢迎来到人人都可写代码,大家好,我是杨晓华,今天我们的课程内容是,项目实操,开发一个发布活动界面的H5. 这是要实现的H5发布活动界面展示效果,下面就是教大家如何制作的步骤: 1.在views的项目s ...
最新文章
- syslog服务器默认使用协议,什么是syslog协议?
- c# 逆转数组元素的排序
- xtrabackup之innobackupex命令参数
- Centos7将firewall替换成iptables
- 关于Python的编码注释# -*- coding:utf-8 -*- 详解
- dedecms index_testenv.php,一招方面解决DedeCms后台反应慢
- 还没掌握Linux文件权限与目录配置命令?就这还不点进来看看干货
- 【Linux系统编程】进程同步与互斥:System V 信号量
- SpringMVC防止XSS攻击
- 引用网易等相册的图片出现防盗链怎么办呢?看这里就迎刃而解!(转贴)
- 深度学习最全优化方法总结比较(SGD,Adagrad,Adadelta,Adam,Adamax,Nadam)(转)...
- php 126 发邮件,解析php中用PHPMailer来发送邮件的示例(126.com的例子)
- java环境安装 linux,Linux Java环境配置安装
- Java开源内容管理CMS系统J4CMS的几个样式
- 【学习体会】aligned_malloc实现内存对齐
- WPS Office 2019 for Linux(WPS 2019 文字操作指引)
- 提高医疗信息化或是解决看病难看病贵的有效助剂
- Sass 你了解了吗
- FusionCharts--WEB图表技术
- 动态壁纸给linux发行版添加活力背景
热门文章
- Warning: Accessing non-existent property ‘cd‘ of module exports inside circular dependen
- 功能最全的上海盐谷小程序商城源码
- 小白学习图像处理7——Hough变换检测直线
- 【图像-关键点json标签】的数据集生成器
- ddos 常用八大命令
- 制作uefi的kali安装盘_uefi版u盘启动盘怎么制作|最新uefi版本u盘制作方法
- pr转场 卡通炫酷图形动画视频转场pr模板mogrt
- 002永磁电机的发展:让你全面了解永磁电机的前世今生,看不明白来打我
- 致在大学中感到迷茫或即将进入大学的你!
- Nutch的插件机制