10.21 1701H4 第十天总结

来源:互联网 发布:2016安全软件排名 编辑:程序博客网 时间:2024/05/10 15:55

今天看了微课的逻辑运算符部分,了解了关于它的知识:

逻辑运算符号:&&,||,!

运算结果为true(1) false(0)

     &&与 两个数都为true则结果为true

     ||或 只要一个为true则结果为true

     !非 true则false

优先级!>算术运算>关系运算>&&>||

逻辑值:非0为true,0为false


判断闰年:

#include<iostream>
using namespace std;
int main()
{
int y;
bool f;
cin >> y;
f = ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0);
cout << f << endl;
system("pause");
return 0;
}