| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 450 人关注过本帖
标题:[求助]按书上的写的,编译出错了
只看楼主 加入收藏
dubaoshi
Rank: 1
等 级:新手上路
帖 子:118
专家分:0
注 册:2006-9-22
收藏
 问题点数:0 回复次数:2 
[求助]按书上的写的,编译出错了

以下程序,在编译时出错了,我用的是win-tc,我也不知道是哪里错了啊,我看书上就是这样写的
#include<stdio.h>
#define DELAY 128000

void update(struct my_time *t);

struct my_time{
int hours;
int minutes;
int seconds;
};

int main(void)
{
struct my_time systime;
systime.hours=0;
systime.minutes=0;
systime.seconds=0;

for(;;){
update(&systime);
display(&systime);
}

void update(struct my_time *t)/*就是这句出的错,我想可能是由于版本的原因吧,可是我不知道要怎么改,高手请指点一二,谢谢!*/
{
t->seconds++;
if(t->seconds==60){
t->seconds=0;
t->mintes++;
}
delay();

}

void delay(void)
{
long int t:

for(t=1;t<DELAY;++t);
}

void display(struct my_time *t)
{
printf("%02d:",t->hours);
printf("%02d:",t->minutes);
printf("%02d:",t->seconds);

搜索更多相关主题的帖子: 编译 
2006-09-29 20:50
playlinshu
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2006-1-31
收藏
得分:0 

能编译时 的错误提示也发上来看一下么?


2006-09-30 08:44
ww84020209
Rank: 1
等 级:新手上路
帖 子:190
专家分:0
注 册:2006-8-21
收藏
得分:0 

[CODE]
#include<stdio.h>
#include <stdlib.h>
#define DELAY 128000

void update(struct my_time *t);
void display(struct my_time *t);
void delay(void);

struct my_time
{
int hours;
int minutes;
int seconds;
};

int main(void)
{
struct my_time systime;
systime.hours=0;
systime.minutes=0;
systime.seconds=0;
for(;;)
{
system ("cls");
update(&systime);
display(&systime);
}
return 0;
}

void update(struct my_time *t)
{

delay();
t->seconds++;
if(t->seconds==60)
{
t->seconds=0;
t->minutes++;
}
if(t->minutes==60)
{
t->minutes=0;
t->hours++;
}
if(t->hours==24)
t->hours=0;
}

void delay(void)
{
long int t;
for(t=1;t<DELAY;++t);
}

void display(struct my_time *t)
{
printf("%02d:",t->hours);
printf("%02d:",t->minutes);
printf("%02d",t->seconds);
}

[/CODE]


2006-09-30 14:55
快速回复:[求助]按书上的写的,编译出错了
数据加载中...
 
   



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

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