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

📄 wise1.c

📁 C.Game.Programming.For.Dummies原码
💻 C
字号:
/*
WISE.C - a series of programs to test logical
comparisons: && = AND, || = OR
*/

#include <stdio.h>
#include <ctype.h>
#include <conio.h>

#define WISE 1				//Wise is TRUE
#define SILLY !(WISE)			//Silly is FALSE

void main()
{
	char c;
	int Poindexter,Melvin;

	printf("Who is wise, Poindexter or Melvin?\n");
	printf("Type P or M:");
	c=toupper(getch());			//get input
	if(c=='p' || c=='P')			//they typed P
	{
		printf("P\n");		//display their input
		Poindexter=WISE;	//Make 'em wise or
		Melvin=SILLY;		//silly
	}
	else
	{
		printf("M\n"); 		//display input
		Poindexter=SILLY;
		Melvin=WISE;
	}

//These comparisions display the results

	if(Poindexter==WISE && Melvin==SILLY)
		printf("Poindexter is wise and Melvin is silly.\n");
	if(Poindexter==SILLY || Melvin==SILLY)
		printf("Either Poindexter or Melvin is silly.\n");
	if(Poindexter==WISE || Melvin==WISE)
		printf("Either Poindexter or Melvin is wise.\n");
	if(Poindexter==SILLY && Melvin==WISE)
		printf("Poindexter is silly and Mevlin is wise\n");
	if(Poindexter==SILLY || Melvin==WISE)
		printf("Either Poindexter is silly or Melvin is wise.\n");
}

⌨️ 快捷键说明

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