请各位C的高手帮忙看个程序,一点不懂啊......

来源:百度知道 编辑:UC知道 时间:2024/05/16 08:58:42
/* 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 count\n");
printf("on the command 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");

return;
getch();}
请详细解答一下~~~谢!!!!!!!!!!!!!!!!

帮你大概解译下吧。。
/* Countdown program. */
# include <stdio.h>
# include <stdlib.h>
# include <ctype.h>
# include <string.h>
//上面是头文件包含。
void main(int argc, char* argv[]) //设定带参数的MAIN函数。
{
int disp, count;

if(argc < 2) //如果小于2个参数则
{
printf("You must enter the length of the count\n");
printf("on the command line. Try again\n");
exit(1); /* 非正常跳出程序 */
}

if(argc==3 && !strcmp(argv[2], "display")) //如果得到的参ARGC参数==3并且,第二个参数,为DISPLAY。则后面显示。
disp = 1;
else
disp = 0;
for(count = atoi(argv[1]); count; --count) //将得到的参数1,转化为数字,用作倒计时。
if(disp)
printf("%d\n", count); //显示计时数。

putchar('\a'); /* 将产生蜂鸣 */
printf("Down"); //显示DOWN

return;// 无返回值
getch();} 暂停。

可能就是这样的...:)

希望你把最后两句改成:
getch();
return;}
之后