该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
完全采用笨办法:
#include "stdio.h"
#include "conio.h"
void hua(int a11,int a12,int a13,int a21,int a22,int a23,int a31,int a32,int a33){
if(a11==1)printf("*");else printf(" ");
if(a12==1)printf("*");else printf(" ");
if(a13==1)printf("*");else printf(" ");
printf("\n");
if(a21==1)printf("*");else printf(" ");
if(a22==1)printf("*");else printf(" ");
if(a23==1)printf("*");else printf(" ");
printf("\n");
if(a31==1)printf("*");else printf(" ");
if(a32==1)printf("*");else printf(" ");
if(a33==1)printf("*");else printf(" ");
printf("\n");
}
main(){
int b11=1,b12=1,b13=1,b21=1,b22=1,b23=1,b31=1,b32=1,b33=1;
int x;
asd:
scanf("%d",&x);
switch(x){
case 1:b21*=-1,b31*=-1,b32*=-1;break;
case 2:b22*=-1,b31*=-1,b32*=-1,b33*=-1;break;
case 3:b23*=-1,b32*=-1,b33*=-1;break;
case 4:b11*=-1,b21*=-1,b22*=-1,b31*=-1;break;
case 5:b12*=-1,b21*=-1,b22*=-1,b23*=-1,b32*=-1;break;
case 6:b13*=-1,b22*=-1,b23*=-1,b33*=-1;break;
case 7:b11*=-1,b12*=-1,b21*=-1;break;
case 8:b11*=-1,b12*=-1,b13*=-1,b22*=-1;break;
case 9:b12*=-1,b13*=-1,b23*=-1;break;
default:goto zxc;
}
hua(b11,b12,b13,b21,b22,b23,b31,b32,b33);
if(b11==-1&&b12==-1&&b13==-1&&b21==-1&&b22==-1&&b23==-1&&b31==-1&&b32==-1&&b33==-1)goto qwe;
else goto asd;
qwe:printf("You Win!");
getch();
zxc:printf("Game Over");
getch();
}