c09_15.c

来自「it can help you know C++ souce program q」· C语言 代码 · 共 27 行

C
27
字号
#include <stdio.h>
#include <string.h>

int main()
{
	char *question = "Where are do you want to go? [1:West, 2:North , 3:Easr , 4:South]\n",
	*pwest = "West. There are a larger building.",
	*pnorth = "North. There are no way.",
	*peast="East. Go down, You can find a Magic Miror.",
	*psouth = "South. There are an old man.";
	enum location { west=1, north=2, east=3, south=4};
	enum location direction;

	puts(question);
	scanf("%d", &direction);
	switch (direction)
	{
		case  west: puts(pwest); break;
		case north: puts(pnorth); break;
		case  east: puts(peast); break;
		case south: puts(psouth); break;
		default: printf("stay here.\n"); break;
	}

	return 0;
}

⌨️ 快捷键说明

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