2015年11月13日
来源:互联网 发布:淘宝怎么上淘抢购 编辑:程序博客网 时间:2024/05/01 10:43
逻辑连接词
/*闰年的判断
#include<stdio.h>
main()
{
int i;
scanf("%d",&i);
if((i%4==0||i%100!=0)&&(i%400==0))
printf("%d是闰年\n",i);
else
printf("%d不是闰年\n",i);
system("pause");
}
*/
/*逻辑运算中常犯的错误
#include<stdio.h>
main()
{
int a,b;
a=10,b=5;
//printf("%d\n",a>8>b);
printf("%d\n",a>8||8>b);
system("pause");
}
*/
//注意逻辑运算的顺序
极客上学习了
/*字符串输出
#include<stdio.h>
main()
{
char str[]="Laura";
puts(str);
system("pause");
}
*/
/*格式符
1."%md"
2."%ld":long long、scanf双精度输出。
3."%0":8进制
4."%x":16进制
5."%u"
6."%-m.nf"
7,如果要输出"%"需要打印%%。
#include<stdio.h>
main()
{
printf("%03d\n",3);
//printf("%3d\n",3) 注意两者区别
system("pause");
}
#include<stdio.h>
main()
{
printf("%o\n",8);//8进制输出
system("pause");
}
*/
/*c语言常用运算符
一.位运算(运算速度快):
1."|":位与
2."&":位或
3."~":位反 0b00000001 求反 0b11111110
4."^":异或 两个元素不同时输出1,相同时输出0
5.">>":右移
6."<<";左移
#include<stdio.h>
main()
{
int a=7;
int b=5;
printf("%d\n",a&b);
system("pause");
}
#include<stdio.h>
main()
{
int a=7;
int b=5;
printf("%d\n",a|b);
system("pause");
}
#include<stdio.h>
main()
{
int a=1;
a=~a;
printf("%d\n",a);
system("pause");
}
#include<stdio.h>
main()
{
int a=9;
int b=5;
printf("%d\n",a^b);
system("pause");
}
*/
/*常用函数
1."sin":输出的是弧度数
2.sqrt
3.pow
4.log
注意声明函数,函数的使用格式
#include <stdio.h>
#include <math.h>
int main ()
{
double param, result;
param = 4;
result = log2(param);
printf ("log2(%f) = %f\n", param, result );
system("pause");
}
*/
0 0
- 2015年11月13日
- 11月13日
- 11月13日
- 2015年1月13日
- 2015年2月13日
- 2015年3月13日工作总结
- 2015年3月13日
- 2015年04月13日学习
- 2015年10月13日 星期二
- 2015年10月13日
- 2015年06月13日
- 2015年06月13日
- 2015年06月13日
- 2015年2月11日
- 2015年3月11日工作总结
- 2015年3月11日
- 2015年7月11日UITableView3
- 2015年7月11日-FW
- laravel_db_operation
- 快排
- 1006. Sign In and Sign Out (25)
- C++ typedef用法小结 (※不能不看※)
- SortedSet 接口 源代码
- 2015年11月13日
- char 与 unsigned char的本质区别
- 阿里云部署Django项目(超详细图文教程)—— Part3. Django settings修改、PostgreSQL配置
- 字符串之逆序(java实现)
- OC协议的应用-代理
- sim900A透传调试及问题解决
- 不是土豪,我做不到呀。
- about HashMap
- hdu2070 Fibbonacci Number(记忆化搜索&&递归)