国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

魔方算法

2019-11-17 05:33:52
字體:
來源:轉載
供稿:網友
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
int a[3][3]={1,1,1,1,1,1,1,1,1};                      /*IN99vIALIZE SIX PLANS*/
int b[3][3]={2,2,2,2,2,2,2,2,2};
int c[3][3]={4,4,4,4,4,4,4,4,4};
int d[3][3]={3,3,3,3,3,3,3,3,3};
int e[3][3]={5,5,5,5,5,5,5,5,5};
int f[3][3]={7,7,7,7,7,7,7,7,7};
int top[3][3],front[3][3],side[3][3];
int position=0,temp[3]={0,0,0},new[3][3];             /*POS99vION ASSIGN THE ARROW POS99vION*/
int sign;
main()
{
int l=60,x=50,y=50,key,count,input=0,errorcode;                 /*L MEANS THE LENTH OF THE SQUARE,X MEANS THE IN99vAIL POS99vION OF X,Y MEANS THE IN99vIAL POS99vION OF Y*/
int a1[3][3]={1,1,1,1,1,1,1,1,1};                     /*IN99vIALIZE SIX PLANS FOR BACKUP*/
int b1[3][3]={2,2,2,2,2,2,2,2,2};
int c1[3][3]={4,4,4,4,4,4,4,4,4};
int d1[3][3]={3,3,3,3,3,3,3,3,3};
int e1[3][3]={5,5,5,5,5,5,5,5,5};
int f1[3][3]={7,7,7,7,7,7,7,7,7};
int graphdriver=VGA,graphmode=VGAHI;
initgraph(&graphdriver,&graphmode,"");
errorcode = graphresult();
if (errorcode != grOk)                                /*MEET ERROR*/
{                                                     /*SHOW THE ERROE*/
printf("Press any key to exit:");
getch();
exit(1);
}
drawing(x,y,l);                                       /*DRAWING THE BIG SQUARE*/
drawing(x+400,y,l/2);                                 /*DRAWING THE SMALL SQUARE*/
do
{
sign=position%3;                                      /*COPY DATA TO SHOW*/
copy (&a,&top);
copy (&b,&front);
copy (&c,&side);
color(x,y,l);                                         /*SHOWING THE BIG SQUARE*/
copy (&e,&top);
change2(&top,1);
copy (&f,&front);
change2(&front,2);
copy (&d,&side);
color(x+400,y,l/2);                                   /*SHOWING THE SMALL SQUARE*/
setcolor(14);
arrow(x,y,l);
key=bioskey(0);                                       /*READ KEYBORD*/
switch(key)
{
case 283:printf("Esc");                               /*IF INPUT_KEY="ESC" TO EX99v THE PROGRAM*/
  goto end;
case 20480:setcolor(0);                               /*IF INPUT_KEY="DOWN" TO CHANGE THE ARROW*/
    arrow(x,y,l);
    if(position==8)
    position=0;
           else
    position=position+1;
           break;                                     /*IF INPUT_KEY="UP" TO CHANGE THE ARROW*/
case 18432:setcolor(0);
    arrow(x,y,l);
    if(position==0)
    position=8;
    else
    position=position-1;
    break;
case 19712:input=1;                                   /*IF INPUT_KEY="RIGHT" TO MOVE FORWARD*/
    break;
case 19200:input=3;                                   /*IF INPUT_KEY="LEFT" TO MOVE REWARD*/
           break;
case 7181: setcolor(0);                               /*IF INPUT_KEY="ENTER" TO RELOAD */
    arrow(x,y,l);
           copy(&a1,&a);
           copy(&b1,&b);
           copy(&c1,&c);
           copy(&d1,&d);
           copy(&e1,&e);
           copy(&f1,&f);
           position=0;
           break;
case 14624:setcolor(0);                               /*IF INPUT_KEY="SPACE" TO RANDOM MOVE*/
    arrow(x,y,l);
           randomize();
           position=random(9);
           input=1;
           break;
}
if(input!=0)                                          /*USE POS99vION TO JUDGE AND CHANGE DATA*/
{                          


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大连市| 平定县| 瑞丽市| 兰西县| 岳西县| 临澧县| 元朗区| 平邑县| 若尔盖县| 浙江省| 商河县| 镇原县| 屏东县| 蒙自县| 贺兰县| 彰化县| 遂川县| 鄂尔多斯市| 芦山县| 东兴市| 鸡东县| 敦煌市| 册亨县| 颍上县| 洱源县| 安塞县| 洪湖市| 乌鲁木齐县| 芦溪县| 资源县| 逊克县| 定兴县| 嘉义市| 利川市| 邹平县| 乌什县| 汾西县| 富平县| 德格县| 察雅县| 郸城县|