C语言第五课:if、else 、if else if else 控制语句
- if else 、if else if else 联合使用
- 编程快速学习平台
if else 、if else if else 联合使用
#include <stdio.h>
int main(){system("chcp 65001");int today = 6;if (today ==1) {printf("今天是星期一,today = %d\n",today);}else if (today ==2) {printf("今天是星期二,today = %d\n",today);}else if (today ==3) {printf("今天是星期三,today = %d\n",today);}else if (today ==4) {printf("今天是星期四,today = %d\n",today);}else if (today ==5) {printf("今天是星期五,today = %d\n",today);}else if (today ==6) {printf("今天是星期六,today = %d\n",today);}else if (today ==7) {printf("今天是星期日,today = %d\n",today);}else {printf("今天是星期几?,today = %d\n",today);}}
- 运行效果

编程快速学习平台