| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 910 人关注过本帖
标题:[求助]一道老潭书上的题
只看楼主 加入收藏
月影骑士
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-7-18
收藏
 问题点数:0 回复次数:16 
[求助]一道老潭书上的题
有50个学生,要求将他们之中成绩在80分以上者打印出来.用N表示学号,N1代表第一个学生学号,NI 代表第I个学生学号,用g代表学生成绩,gi代表第I个学生成绩,算法可表示如下.
S1:1=>I
S2:如果GI大余等于80,则打印NI和GI,否则不打印
S3:I+1=>I
S4:如果I小于等于50,返回S2,继续执行;否则结束

大家能不能提供一个最简单的解答方法,用前面的知识,(本人是初学者,后面的语句看不懂)
搜索更多相关主题的帖子: 学生 大余 
2006-07-19 10:12
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
for(i=1;i<=50;i++)
{
if(g[i]>=80)
{
printf("%6d%3d\n",n[i],g[i]);
}
}

倚天照海花无数,流水高山心自知。
2006-07-19 11:07
月影骑士
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-7-18
收藏
得分:0 
大家能不能提供一个最简单的解答方法,用前面的知识,(本人是初学者,后面的语句看不懂)


FOR是什么意思.?

/priest_ms/58701079/1603639243.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://img503.photo./priest_ms/58701079/1603639243.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2006-07-21 14:10
soft_wind
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:1430
专家分:0
注 册:2006-4-5
收藏
得分:0 

楼主,建议您先去看书.
另外,"大家能不能提供一个最简单的解答方法,用前面的知识,(本人是初学者,后面的语句看不懂)"
这句话不明不白的,前面是前面到哪?您想必是刚在学C吧,先看看书。


对不礼貌的女生收钱......
2006-07-21 14:32
月影骑士
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-7-18
收藏
得分:0 

就是刚刚看到,老潭的书上这个例题,但是我不会解答

楼上的 前辈 都是用后面的知识解答 所以我看不懂


/priest_ms/58701079/1603639243.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://img503.photo./priest_ms/58701079/1603639243.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2006-07-21 17:27
ptr
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2006-7-19
收藏
得分:0 

没学FOR呢,学WHILE没有????


int i=1;

while(i<=50)
{
if(g[i]>=80)
printf("%4d%4d\n",n[i],g[i]);
i++;
}

楼主,你想要的是这个意思吗??

[此贴子已经被作者于2006-7-21 19:00:30编辑过]

2006-07-21 18:59
shuaiye
Rank: 1
等 级:新手上路
帖 子:445
专家分:0
注 册:2006-5-15
收藏
得分:0 
建议你把书完完整整的先看一遍,不要急着编程,先把自己当成一部机器,仔细阅读书上的代码,思考代码。一是可以让你掌握语法结构,二是可以为你看懂别人的代码打好基础,你所提的问题都你自己的问题。(问问自己仔细思考过没有,仔细看书没有,看了几页书?)

由于工作,N久都没来了!
2006-07-21 19:08
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
不是他是想一个一个输出,连判断50次.
这就是最前面的.

倚天照海花无数,流水高山心自知。
2006-07-21 20:02
wuyufenjr
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2006-7-20
收藏
得分:0 
#include <stdio.h>
void main(void)
{int num ,cj;
for(num=1,num<=50;num++)
{scanf("%d",&cj);
if(cj>=80)printf("%d,%d\n",cj,num);
scanf("%d",&cj);
}
}
这样子应该会简单点吧!
2006-07-21 21:26
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 

人家都说没学过FRO了.
他怎么能看的懂你的.
楼主,先看看书吧
建议初学上机抄书上的程序.


倚天照海花无数,流水高山心自知。
2006-07-21 22:10
快速回复:[求助]一道老潭书上的题
数据加载中...
 
   



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

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