试一下怎么发代码

yyoinge 2011-02-19 09:20:21
[code=V]我总是试不出来,为什么呢[/code]
...全文
174 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengye_yuanyuan 2012-03-19
  • 打赏
  • 举报
回复
//到底怎么发哦
fengye_yuanyuan 2012-03-19
  • 打赏
  • 举报
回复
#include
fu65748 2012-03-03
  • 打赏
  • 举报
回复
2
fu65748 2012-03-03
  • 打赏
  • 举报
回复
1
terminalnt 2011-04-16
  • 打赏
  • 举报
回复
我也试试
#include <stdio.h>
#include <math.h>

struct flight
{
char * departure;
char * arriving;
unsigned int minutes;
};

/* Search for the appropriate flight and return its pointer.
* This function will find out the most close time's flight compare
* to the given value of minutes.
* @flights: the struct flight
* @num: the number of flights
* @value: the given value of minutes
*/
struct flight * search(struct flight * flights, unsigned int num, unsigned int value)
{
int i,last_diff=32767,diff;
struct flight * prev = NULL;
struct flight * cur = flights;

/*printf("func:search,value:%d\n",value);*/
for(i = 0; i < num; i++) {
diff = abs(cur->minutes - value);
/*printf("func:search,last_diff:%d,diff:%d\n",last_diff,diff);*/
if(last_diff < diff)
return prev;
last_diff = diff;
prev = cur;
cur++;
}
return prev;
}

int main(void)
{
unsigned int hour,minute,value;
struct flight * result = NULL;
struct flight flights[8] = {
"8:00 a.m.", "10:16 a.m.", 480,
"9:43 a.m.", "11:52 a.m.", 583,
"11:19 a.m.", "1:31 p.m.", 679,
"12:47 p.m.", "3:00 p.m.", 767,
"2:00 p.m.", "4:08 p.m.", 840,
"3:45 p.m.", "5:55 p.m.", 945,
"7:00 p.m.", "9:20 p.m.", 1140,
"9:45 p.m.", "11:58 p.m.", 1305
};
system("cls");
printf("Enter a 24-hour time: ");
scanf("%d:%d",&hour,&minute);
value = hour * 60 + minute;
result = search(flights,8,value);
printf("Closest departure time is %s, arriving at %s.\n\n",
result->departure, result->arriving);
system("pause");

return 0;

}
sonnno 2011-04-02
  • 打赏
  • 举报
回复
1
sonnno 2011-04-02
  • 打赏
  • 举报
回复
1[/code]
sonnno 2011-04-02
  • 打赏
  • 举报
回复
1
yyoinge 2011-03-05
  • 打赏
  • 举报
回复
终于晓得为什么了!
每次在[code=C/C++]与
中间,总是画蛇添足的多按了一下回车键[/code]
myclife 2011-02-24
  • 打赏
  • 举报
回复
1

2

3
myclife 2011-02-23
  • 打赏
  • 举报
回复
[code=C]/C++
main()
{
int a;
return;
}
[/code]
abcofeng 2011-02-23
  • 打赏
  • 举报
回复
[code=C]/C++test[/code]
gui41021 2011-02-21
  • 打赏
  • 举报
回复
[code=C]3[/code]
gui41021 2011-02-21
  • 打赏
  • 举报
回复
1
2
wag_enu 2011-02-20
  • 打赏
  • 举报
回复
[code=SQ]
//CSDN 是不是有问题呢?很久没用这功能了。。。
[/code]
wag_enu 2011-02-20
  • 打赏
  • 举报
回复
[code=C]
// 试一下看。。。
[/code]
glint 2011-02-19
  • 打赏
  • 举报
回复
[code=C]
if
[/code]
yyoinge 2011-02-19
  • 打赏
  • 举报
回复
[code=XM][/code][code=Delphi(Pascal][/code]
yyoinge 2011-02-19
  • 打赏
  • 举报
回复
[BanUBB][code=C]using System;[/code][/BanUBB]
yyoinge 2011-02-19
  • 打赏
  • 举报
回复
[code=CS]还是发不了啊[/code]

401

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 非技术版
社区管理员
  • 非技术版社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧