⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ask.c

📁 C.Game.Programming.For.Dummies.原码
💻 C
字号:
#include <stdio.h>
#include <conio.h>
#define TRUE 1

void main(int argc,char *argv[])
{
	int x;
	char c;

	if(argc<2)		//no options typed
	{
		printf("Here is the ASK program's format:\n");
		printf("ASK [Text]\n");
		printf("\"Text\" is displayed, then the PC\n");
		printf("waits for Y or N to be pressed. Y\n");
		printf("returns an ERRORLEVEL of 1; N is 2.\n");
		exit(0);
	}

/* Print all the arguments */

	for(x=1;x<argc;x++)
		printf("%s\x20",argv[x]);

	printf("(Y or N)?");			//print the YorN prompt

	while(TRUE)
	{
		c=getch();

		if(c=='y' || c=='Y')
		{
			printf("Y\n");		//Display their input
			exit(1);			//ERRORLEVEL=1
		}
		if(c=='n' || c=='N')
		{
			printf("N\n");
			exit(2);			//ERRORLEVEL=2
		}
	}
}

⌨️ 快捷键说明

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