void xianshi2(int sj)
{
void xianshi3(int a1,int a2,int a3,int a4);
void miaozhong();
//if(flag!=0){
switch(sj){
case 0:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 1:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 2:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 3:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 4:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 5:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 6:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 7:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 8:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 9:if(flag!=0){t0=l;l=sj;t1=k;k=t0;t2=j;j=t1;i=t2;flag=0;}xianshi3(l,k,j,i);break;
case 111:if(flag!=0){
s1=i*1000+j*100+k*10+l;
l=0;k=0;j=0;i=0;flag=0;flag2=1;}xianshi3(l,k,j,i);break;
case 112:
if(flag!=0){
s1=i*1000+j*100+k*10+l;
l=0;k=0;j=0;i=0;flag=0;flag2=2;}xianshi3(l,k,j,i);break;
case 113:
if(flag!=0){
s1=i*1000+j*100+k*10+l;
l=0;k=0;j=0;i=0;flag=0;flag2=3;}xianshi3(l,k,j,i);break;
case 114:miaozhong();break;
case 115:if(flag!=0){l=0;k=0;j=0;i=0;flag=0;}xianshi3(l,k,j,i);break;
case 116:if(flag!=0){
switch(flag2){
case 1:
s2=i*1000+j*100+k*10+l;
s3=s1+s2;
m=s3%1000;
n=m%100;
p=n%10;
l=p;
k=n/10;
j=m/100;
i=sj/1000;break;
case 2:
s2=i*1000+j*100+k*10+l;
s3=s1*s2;
m=s3%1000;
n=m%100;
p=n%10;
l=p;
k=n/10;
j=m/100;
i=sj/1000;break;
case 3:
s2=i*1000+j*100+k*10+l;
s3=s1-s2;
m=s3%1000;
n=m%100;
p=n%10;
l=p;
k=n/10;
j=m/100;
i=sj/1000;break;
int key(void) {
int readkey;
int x_temp,y_temp;
DDRB=0X0f;
PUCR_PUPBE=1;
PORTB=0Xf0;
if(PORTB!=0xf0) {
delay(1000);
if(PORTB!=0xf0) {
PORTB&=0xf0;
x_temp=PORTB;
DDRB=0Xf0;
PORTB=0X0f;
// if(PORTB!=0x0f){
PORTB&=0X0f;
y_temp=PORTB;
readkey=(x_temp|y_temp);
PORTB=0X0F;
while(PORTB!=0X0F) {
delay(1000);
while(PORTB!=0X0F){
switch(readkey) {
case 0xee:num=1;break; //1
case 0xde:num=2;break;
case 0xbe:num=3;break;
case 0x7e:num=111;break;
case 0xed:num=4;break;
case 0xdd:num=5;break;
case 0xbd:num=6;break;
case 0x7d:num=112;break;
case 0xeb:num=7;break;
case 0xdb:num=8;break;
case 0xbb:num=9;break;
case 0x7b:num=113;break;
case 0xe7:num=0;break;
case 0xd7:num=115;break;
case 0xb7:num=116;break;
case 0x77:num=114;break;