| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1676 人关注过本帖
标题:时钟显示程序出错帮忙看看!
只看楼主 加入收藏
kenneth.li
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2007-12-26
收藏
 问题点数:0 回复次数:2 
时钟显示程序出错帮忙看看!
void main(void)
{

P1=0xff;
P3=0xff;
initial1();
delay();
uchar h1,h2,m1,m2,s1,s2;
h1=h2=m1=m2=s1=s2=0;
uint s;
while(1)
{

for(s=0;s<60;s++)
{
s1++;

if(s1>9){s1=0;s2++;}
if(s2>6){s2=0;m1++;}
if(m1>9){m1=0;m2++;}
if(m2>6){m2=0;h1++;}
if(h1>9){h1=0;h2++;}
if(h2>2){h2=0;}
delay();
display(s1,0);
display(s2,2);
display(m1,4);
display(m2,6);
display(h1,8);
display(h2,10);
}

}
}

出错信息如下:F:\程序\1621时钟\1621.C(128): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(128): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(129): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(129): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(130): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(130): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(131): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(131): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(132): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(132): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(133): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(133): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(134): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(134): error C202: 's': undefined identifier
F:\程序\1621时钟\1621.C(138): error C202: 's': undefined identifier
F:\程序\1621时钟\1621.C(140): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(142): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(142): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(142): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(143): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(143): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(143): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(144): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(144): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(144): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(145): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(145): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(145): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(146): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(146): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(146): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(147): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(147): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(149): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(150): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(151): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(152): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(153): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(154): error C202: 'h2': undefined identifier



帮帮忙吧@
搜索更多相关主题的帖子: 时钟 display void 
2008-04-28 11:06
sxn0508
Rank: 1
等 级:新手上路
帖 子:120
专家分:0
注 册:2008-1-24
收藏
得分:0 
把定义变量的语句提到main的开始处去
2008-04-28 11:17
kenneth.li
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2007-12-26
收藏
得分:0 
谢谢啦  成功了!!。。。
2008-04-28 11:20
快速回复:时钟显示程序出错帮忙看看!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019100 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved