//_27_命令行变元
//_27_main.cpp
//命令行变元是操作系统命令中执行程序名字之后的信息
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main(int argc,char * argv[])
{
int disp,count;
if(argc<2)
{
printf("You must enter the length of the count\n");
printf("on the commend line.Try again\n");
exit(1);//非正常跳出程序
}
if(argc==3 && !strcmp(argv[2],"display"))
disp = 1;
else
disp = 0;
for(count=atoi(argv[1]);count;--count)
if(disp)
printf("%d\n",count);
putchar('\a');//将产生蜂鸣
printf("Down");
system("pause");
return 0;
}
27_命令行变元
最新推荐文章于 2020-12-21 22:45:15 发布