首页 > 编程语言 > 详细

c++学习笔记(cout小知识点)

时间:2019-09-20 01:33:12      阅读:87      评论:0      收藏:0      [点我收藏+]
 1 #include <iostream>
 2 int main()
 3 {
 4     using namespace std;
 5     int x;
 6 
 7     cout<<"The expression x=100 has the value ";
 8     cout<<(x=100)<<endl;
 9     cout<<"Now x= "<<x<<endl;
10     cout<<"The expression x<3 has the value ";
11     cout<<(x<3)<<endl;                //像x<3这样的关系表达式将被判定为bool值true和false
12     cout<<"The expression x>3 has the value ";
13     cout<<(x>3)<<endl;               //但cout将在显示bool值之前将它们转换成int
14     cout.setf(ios_base::boolalpha);//该函数调用设置了一个标记,该标记命令cout显示true和false,而不是0和1
15     cout<<"The expression x<3 has the value ";
16     cout<<(x<3)<<endl;
17     cout<<"The expression x>3 has the value ";
18     cout<<(x>3)<<endl;
19     return 0;
20 }

 

c++学习笔记(cout小知识点)

原文:https://www.cnblogs.com/zhi321/p/11553086.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!