countdwn.c

来自「C.Game.Programming.For.Dummies原码」· C语言 代码 · 共 33 行

C
33
字号
/* An important program for NASA to properly launch
America's spacecraft. */

#include <stdio.h>

void main()
{
	int start;
	long delay;

/* This loop ensures they type in the proper value */

	do
	{
		printf("Please enter the number to start\n");
		printf("the countdown (1 to 100):");
		scanf("%i",&start);
	}
	while(start<1 || start>100);

/* The countdown loop */	//Example of a "nested loop"

	do
	{
		printf("T-minus %i\n",start);
		start--;
		for(delay=0;delay<1000000;delay++);	//delay loop
	}
	while(start>0);

	printf("Zero!\nBlast off!\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?