精彩百例:exit()函数
2015-03-27 20:14
162 查看
# include <stdio.h> # include <stdlib.h> int main(void) { int month; int day; printf("please input the month number :"); scanf("%d", &month); switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: day = 31;//是大月的输出31天 break; case 4: case 6: case 9: case 11: day = 30;//小月的输出30天 break; case 2: day = 28;//输出28天 break; default: exit(0);//退出程序 } printf("\n2015.%d has %d days.\n", month, day); return 0; }运行结果是:
相关文章推荐
- 精彩百例:函数指针和typedef的应用
- 精彩百例:函数指针
- 精彩百例:数组函数调用
- 精彩百例:函数的递归调用
- Exit()函数
- (经验分享)万能的退出函数exit VS ExitProcess
- exit () 函数
- exit()函数详解与Exit() 和 Return() 的区别
- 使用C++异常来取代exit()函数
- Linux中pthread_exit函数设置是否合理?
- exit()函数详解和Exit() 和 Return() 的差别
- exit(0)函数
- 进程控制之exit和waitpid(wait)函数
- C_在switch-case语句中使用exit()函数求非闰年的每月天数
- exit()函数详解与Exit() 和 Return() 的区别
- Window关机函数ExitWindowsEx详解
- 几个出错处理的函数abort、exit、atexit、strerror函数的使用方法
- Window关机函数ExitWindowsEx详解 - dwdm - 博客园
- [导入]php exit 函数的一个Notice
- 关于perl中Exit的函数使用