语法-分支
新建项branch.c
1.if
将branch.c最后一个main方法的名改为main12
添加stdbool.h里的true
#include <stdio.h>
#include <stdbool.h>
int main(void) {
int a = 1;
if (true) {
printf("true");
}
return 0;
}
2.if...else
将上一个main方法的名改为main21
int main(void){
if (false) {}
else
{
printf("false");
}
return 0;
3.if...else if...else
将上一个main方法的名改为main22
int main(void) {
char true_or_false = fgetchar();
if (true_or_false == 'y') {
printf("first_true");
}
else if (true_or_false == 'n') {
printf("second_true");
}
else {
printf("false");
}
return 0;
}


浙公网安备 33010602011771号