佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

楼主: spannar90^_^

各位C++高手请进来。小弟有大大问题。

[复制链接]
 楼主| 发表于 5-11-2009 09:50 PM | 显示全部楼层

回复 60# yeenfei 的帖子

哇,不要这样。看看除了ABC错误,其它还好吗?
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 5-11-2009 09:51 PM | 显示全部楼层
等我呀。要做家务。男人竟然到这样地步。。。
回复

使用道具 举报

 楼主| 发表于 5-11-2009 10:01 PM | 显示全部楼层
那么快下线吗?喂!
回复

使用道具 举报

发表于 5-11-2009 10:14 PM | 显示全部楼层
  1. start
  2. read unit
  3. if unit <200
  4.       display "A x 20sen"
  5. else if unit>300
  6.       display "a x 20sen +B x 25sen"
  7. else if unit < 300
  8.       display "Ax20sen+B x 25sen+C x28sen"
  9. stop
复制代码

你的第一个if 已经不符合first 200=20sen
第二个和第三个完全错了。


你有时间解释, 倒不如拿那些时间读书。
回复

使用道具 举报

发表于 5-11-2009 10:39 PM | 显示全部楼层
http://www.youtube.com/user/hhemanth#p/c/49A79E830E067C30
的空去看看, 里面有c的基本教学。
回复

使用道具 举报

 楼主| 发表于 5-11-2009 10:54 PM | 显示全部楼层

回复 67# 糯米鸡 的帖子

那么那个应该怎样改?
回复

使用道具 举报

Follow Us
发表于 5-11-2009 10:56 PM | 显示全部楼层
原帖由 spannar90^_^ 于 5-11-2009 10:54 PM 发表
那么那个应该怎样改?


你知道 < 是什么来的吗?
回复

使用道具 举报

 楼主| 发表于 5-11-2009 11:03 PM | 显示全部楼层

回复 67# 糯米鸡 的帖子

那个不是小过吗?

[ 本帖最后由 spannar90^_^ 于 5-11-2009 11:17 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 5-11-2009 11:04 PM | 显示全部楼层
哎呀。忘记放=。。。因为有用到。
回复

使用道具 举报

 楼主| 发表于 5-11-2009 11:20 PM | 显示全部楼层

回复 67# 糯米鸡 的帖子

糯米鸡,你在那里吗?因为这个不熟。但是还知道怎样用。应该是怎样的?
回复

使用道具 举报

发表于 5-11-2009 11:27 PM | 显示全部楼层
你一个个unit放进去就知道了。 比如将150, 200, 250, 300, 350
回复

使用道具 举报

 楼主| 发表于 5-11-2009 11:31 PM | 显示全部楼层
不是很明白。不过要拿symbol来代替吗?因为题目是pseudocode。只是要写出来而已。
sample.
start
total=0
for(i=1;i_< 10;add i to 1)
          total=total +i
stop
回复

使用道具 举报

发表于 5-11-2009 11:32 PM | 显示全部楼层
原帖由 onlylonly 于 5-11-2009 09:42 PM 发表
这是统考, 无须奇怪, 统考久等于你现在读的 STPM,于 A-LEVEL 同样等级。


我的老师说没有A-LVL这样高哦。不过最近几年出的题目比较有A-LVL水准了
回复

使用道具 举报

发表于 5-11-2009 11:41 PM | 显示全部楼层
  1. if ( unit<=300 )
  2. {
  3.     if ( unit<=200 )
  4.     total = unit*20;
  5.     else
  6.     total = 200*20 + (unit-200)*25;
  7. }
  8. else
  9. {
  10.     total = 200*20 + 100*25 + (unit-200-100)*28;
  11. }
复制代码
以上可以供参考。
也欢迎高手置评。

[ 本帖最后由 mash143 于 5-11-2009 11:44 PM 编辑 ]
回复

使用道具 举报

 楼主| 发表于 5-11-2009 11:46 PM | 显示全部楼层

回复 74# mash143 的帖子

哦,原来是这样的。他所谓说的是拿最大的放上面。然后才在内做。明白一点。谢谢。
回复

使用道具 举报

发表于 5-11-2009 11:50 PM | 显示全部楼层

回复 75# spannar90^_^ 的帖子

不一定要这样的。可以有别的解法(思路)的 。要自己多想想。加油。
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 5-11-2009 11:53 PM | 显示全部楼层
然后另一个题目。
start wait reading one character code and two integer entered by a user.if the character code is I,diplay the sum of two integer.if the character code is B,display the difference betwwen the two integer.if the character is K.display message the end and stop.if others than above this type code.display wrong code..the algorithm will repeat as long as the user does not input the end character code

start
read code
if code='I'
display"sum of two integer"
else if code='B'
display"difference of two integer"
else if code='K'
display "the end"
else if code 'others'
display "wrong code"
stop
是这样吗?
回复

使用道具 举报

 楼主| 发表于 5-11-2009 11:58 PM | 显示全部楼层

回复 76# mash143 的帖子

哦。那么多路呀??是否把里面跳换?
回复

使用道具 举报

发表于 6-11-2009 10:09 AM | 显示全部楼层
  1. if(total_unit > 300)
  2. {
  3.     additional_unit = total_unit - 300;   
  4.     next_unit = 100;
  5.     first_unit = 200;
  6. }
  7. else if(total_unit > 200 && total_unit <= 300)
  8. {
  9.     additional_unit = 0;   
  10.     next_unit = total_unit - 200;
  11.     first_unit = 200;
  12. }
  13. else if(total_unit <= 200)
  14. {
  15.     additional_unit = 0;
  16.     next_unit = 0;
  17.     first_unit = total_unit;
  18. }

  19. additional_price = additional_unit * 28;
  20. next_price = next_unit * 25;
  21. first_price = first_unit * 20;

  22. total_price = first_price + next_price + additional_price;
复制代码
有时问题并不是要从头做到尾,其实也可以从尾倒回头的解决的。
回复

使用道具 举报

发表于 6-11-2009 10:25 AM | 显示全部楼层
原帖由 spannar90^_^ 于 5-11-2009 11:53 PM 发表
然后另一个题目。
start wait reading one character code and two integer entered by a user.if the character code is I,diplay the sum of two integer.if the character code is B,display the difference bet ...


不完全对。你的逻辑思考有待改善。
  1. start
  2. read code
  3. if code='I'
  4. get integer1
  5. get integer2
  6. display (integer1 + integer2), go to start
  7. else if code='B'
  8. get integer1
  9. get integer2
  10. display (integer1 - integer2), go to start
  11. else if code='K'
  12. display "the end", go to stop
  13. else if code 'others'
  14. display "wrong code", go to start
  15. stop
复制代码

[ 本帖最后由 geekman 于 6-11-2009 10:28 AM 编辑 ]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT


本周最热论坛帖子本周最热论坛帖子

ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 9-12-2025 07:52 PM , Processed in 0.127411 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表