找回密码
 立即注册
查看: 3829|回复: 0

求助!新手小白!其实好像很简单!

[复制链接]
发表于 2016-11-15 01:49:51 | 显示全部楼层 |阅读模式
课上老师出的一道题,关于编写简单程序的,各位大神看来应该很简单,但是我刚开始学太笨了,求指教!翻译成中文大概就是要编写一个找钱的程序,比如要找6.42,这个程序要显示出需要几个5元,几个2元,几个1元,几个0.5,几个0.1,几个0.01······

Question 3 Make change.
Suppose there are types of coins, 5 mops, 2 mops, 1 mop, 50 cents, 10 cents and 1 cent.  You are asked to write a function for a cashier to make changes. For example, how many 5-mop, 2-mop, 1-mop, 50-cent, 10-cent, and 1-cent coins are needed for 8.47 mops?
a. Test your function for 6.42 mops.
b. Sometimes, cashier receives Hong Kong dollars, or Renminbi. Modify your function to include currency rates, e.g., 1 HKD=1.03 MOP, and 1 YUAN=1.18 MOP. Test your function for 100.5 Yuan, and 130.2 HKD.



回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|R语言中文网

GMT+8, 2024-11-26 12:02 , Processed in 0.023352 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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