键盘输入赋值到数组问题
时间:10-02
整理:3721RD
点击:
void press(uchar *s)
{
nn: P3=0xf0; //保存个位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat>=0&&dat<10)
{
*s=dat;
price_shuzhi(1,dat+0x30);//显示单价
s++;
}
if(dat==16) //去皮
{qi_weight=weight+qi_weight;goto nn;}
if(dat==15) //置零
{
zero();
goto nn;
}
//**************************************************
mm: P3=0xf0; //保存十位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat>=0&&dat<10)
{
*s=dat;
price_shuzhi(2,dat+0x30);//显示单价
s++;
}
if(dat==16) //去皮
{s--;*s=0;price_shuzhi(1,' ');goto nn;}
if(dat==12) //清除
{price_shuzhi(1,' ');goto nn;}
if(dat==15) //置零
{
zero();
goto nn;
}
//**************************************************
zz: P3=0xf0; //保存百位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat>=0&&dat<10)
{
*s=dat;
price_shuzhi(4,dat+0x30);//显示
}
if(dat==12) //清除
{
s--;*s=0;price_shuzhi(2,' ');goto mm;}
if(dat==16) //去皮
{qi_weight=weight+qi_weight;goto zz;}
if(dat==15) //置零
{
zero();
goto nn;
}
//**************************************************
xx:
do{
P3=0xf0; //清除百位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat==16) //去皮
{qi_weight=weight+qi_weight;goto xx;}
if(dat==12) //清除
{*s=0;price_shuzhi(4,' ');goto zz;}
if(dat==15) //置零
{
zero();
goto nn;
}
}while(dat!=14);
}
uchar pricetable[3]={0,0,0}为全局数组;
最后在主函数中调用press(pricetable)
请问键值赋值到pricetable中没?
jianzhi=(uint)((pricetable[0]*100)+(pricetable[1]*10)+pricetable[2]);
我希望得到jianzhi;
{
nn: P3=0xf0; //保存个位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat>=0&&dat<10)
{
*s=dat;
price_shuzhi(1,dat+0x30);//显示单价
s++;
}
if(dat==16) //去皮
{qi_weight=weight+qi_weight;goto nn;}
if(dat==15) //置零
{
zero();
goto nn;
}
//**************************************************
mm: P3=0xf0; //保存十位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat>=0&&dat<10)
{
*s=dat;
price_shuzhi(2,dat+0x30);//显示单价
s++;
}
if(dat==16) //去皮
{s--;*s=0;price_shuzhi(1,' ');goto nn;}
if(dat==12) //清除
{price_shuzhi(1,' ');goto nn;}
if(dat==15) //置零
{
zero();
goto nn;
}
//**************************************************
zz: P3=0xf0; //保存百位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat>=0&&dat<10)
{
*s=dat;
price_shuzhi(4,dat+0x30);//显示
}
if(dat==12) //清除
{
s--;*s=0;price_shuzhi(2,' ');goto mm;}
if(dat==16) //去皮
{qi_weight=weight+qi_weight;goto zz;}
if(dat==15) //置零
{
zero();
goto nn;
}
//**************************************************
xx:
do{
P3=0xf0; //清除百位
while(P3==0xf0)
{
get_weight();//得到重量
if(weight>0)
{weight_shuzhi(weight);}//显示重量
else
{weight_shuzhi(-weight);}
}
dat=get_key();
if(dat==16) //去皮
{qi_weight=weight+qi_weight;goto xx;}
if(dat==12) //清除
{*s=0;price_shuzhi(4,' ');goto zz;}
if(dat==15) //置零
{
zero();
goto nn;
}
}while(dat!=14);
}
uchar pricetable[3]={0,0,0}为全局数组;
最后在主函数中调用press(pricetable)
请问键值赋值到pricetable中没?
jianzhi=(uint)((pricetable[0]*100)+(pricetable[1]*10)+pricetable[2]);
我希望得到jianzhi;