学习内容:
1. 逻辑类型:
- bool
2. 逻辑运算:
- !:逻辑非
- &&:逻辑与
- ||:逻辑或
3.条件运算
4.if-else的运用
学习时间:
下午20点–下午22点
学习产出:
1.bool的运用
#include<stdio.h>
#include<stdbool.h>
int main()
{
bool b=6>5;
bool t= true;
t=2;
printf("%d\n",b);
return 0;
}
2.逻辑运算
#include<stdio.h>
int main()
{
int a=-1;
if(a>0&&a++> 1){
printf("OK\n");
}
printf("%d\n",a);
return 0;
}
3.swich的运用
#include<stdio.h>
int main()
{
const int MRN = 2;
int type;
scanf("%d",&type);
switch(type){
case 1:
printf("你好");
break;
case 2:
printf("早上好");
break;
case 3:
printf("晚上好");
break;
case 4:
printf("再见");
break;
default:
printf("啊?什么啊?");
break;
}
}