|
|
@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
|
|
|
#include<iostream>
|
|
|
|
|
|
|
|
/*定义三个函数*/
|
|
|
|
|
|
|
|
void White(){
|
|
|
|
|
|
|
|
{ system("color e");
|
|
|
|
|
|
|
|
for(int i=0;i<8;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for(int j=0;j<8;j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if((i+j)%2==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("%c%c",168,128);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Yellow()
|
|
|
|
|
|
|
|
{/*打印国际象棋棋盘*/
|
|
|
|
|
|
|
|
/*用不了图库,用ascall码168和128以及空格代替*/
|
|
|
|
|
|
|
|
for(int i=0;i<8;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for(int j=0;j<8;j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if((i+j)%2==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%c%c",168,128);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Goodbye(){printf("Goodbye!\n");}
|
|
|
|
|
|
|
|
/*驱动实现*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/*设置退出开关的状态*/
|
|
|
|
|
|
|
|
bool quit=false;
|
|
|
|
|
|
|
|
int input;
|
|
|
|
|
|
|
|
/*循环*/
|
|
|
|
|
|
|
|
while(!quit)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/*打印菜单*/
|
|
|
|
|
|
|
|
printf("欢迎绘制国家象棋棋盘\n");
|
|
|
|
|
|
|
|
printf("请输入数字代表你想要的颜色\n") ;
|
|
|
|
|
|
|
|
printf("1.Yellow 2.White 3.Goodbye! Input 1-3:");
|
|
|
|
|
|
|
|
/*接收输入*/
|
|
|
|
|
|
|
|
input=getchar()-0x30,getchar();
|
|
|
|
|
|
|
|
/*选择分支*/
|
|
|
|
|
|
|
|
switch(input)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 1:White();quit=true;break;
|
|
|
|
|
|
|
|
case 2:Yellow();quit=true;break;
|
|
|
|
|
|
|
|
case 3:Goodbye();quit=true;break;
|
|
|
|
|
|
|
|
default:break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|