countdown.c
上传用户:bjtelijie
上传日期:2010-01-01
资源大小:87k
文件大小:1k
- /* Countdown program. */
- # include <stdio.h>
- # include <stdlib.h>
- # include <ctype.h>
- # include <string.h>
- void main(int argc, char* argv[])
- {
- int disp, count;
- if(argc < 2)
- {
- printf("You must enter the length of the countn");
- printf("on the command line. Try againn");
- exit(1); /* 非正常跳出程序 */
- }
- if(argc==3 && !strcmp(argv[2], "display"))
- disp = 1;
- else
- disp = 0;
- for(count = atoi(argv[1]); count; --count)
- if(disp)
- printf("%dn", count);
- putchar('a'); /* 将产生蜂鸣 */
- printf("Down");
- return;
- }