« links for 2006-10-25 | Main | 整人:装满了水的陷阱(视频) »


学习一个新的程序设计语言应该进行的15个练习

摘自: Fifteen Exercises for Learning a new Programming Language

1、无穷循环显示数字数列(1、2、3、4、5、6、……、等等),按指定键退出程序(比如 Esc 键)
2、斐波纳契数列,交换两个变量,在一个数字列表中查找最大/最小的数字
3、键盘输入一些数字,然后递增/递减排序输出
4、用公式 (D*V*rho)/mu 来计算雷诺数,其中 D=直径、V=加速度、rho=密度、mu=粘稠度。输入给程序一些数据(先不要管单位转换)
如果结果小于2100,就显示 Laminar flow
如果结果介于 2100 和 4000 之间,就显示 Transient flow
如果大于4000就显示 Turbulent Flow
(if..else..then 条件判断)
5、修改前面的程序,最后增加一个提示“是不是再来一次?(y/n)”,如果回答 y,程序就重新要求输入这些参数。如果是“n”就退出程序
(do while 循环)
在程序运行时,给 mu 变量赋值为 0,看看会发生什么,是不是出现了“DIVID BY ZERO”错误?或者是不是出现了”Segmentation fault..coredump"?怎样处理这种情形?程序有没有内建了什么处理机制么?(异常处理)
6、科学计算,要求支持加、减、乘、除、开方、平方、立方、sin、cos、tan、阶乘、取反、取模
7、用不同的格式打印输出,四舍五入保留4位小数,左右补0对齐(输入/输出操作)
8、打开一个文本文件,转换成 HTML 文件(文件操作/字符串处理)
9、时间和日期:获取操作系统时间,再转换成不同的格式输出,比如: 'DD-MON-YYYY', 'mm-dd-yyyy', 'dd/mm/yy' 等等
10、建立一个文件,把文件的创建日期和时间戳附在文件名后面
11、输入一个 HTML 表格,删除所有的标签,把数据用逗号/制表符分割保存到文件中
12、找出文件中的所有大写单词,去除重复的
13、实现自动换行功能(注意观察在 Windows 的记事本中的自动换行是怎样工作的)
14、在数组的开头、中间和结尾添加/删除数据
15、正在学习的这个程序设计语言是不是还有一些其他特性:操作符重载,虚函数、引用、指针等等。这个语言是不是还支持一些叫做“namespace/package/module”的东西?多看看


Comments

偶要转一下这个文章,谢谢~

thanks

Mittlerweile ziehst DU Deine Muschi auseinander und drückst meinen Kopf fest an Sie. Sie wird immer feuchter und Dein Saft lauft jetzt schon an Deinen Innenschenkeln herunter, die ich von unten nach oben ablecke um immer wieder an Deine Muschi stehen zu bleiben. Langsam komme ich mit meiner Zunge über Deinen Bauch und Deine Titten zu Dir hoch und wir küsen uns leidenschaftlich.

Impressive conquer ! I would like to apprentice while you amend your website, how does someone sign up to for your web log? The particular bank account aided me a tolerable offer. I became a bit more knowledgeable for this your current sent out furnished dazzling distinct thought

Major thankies for the post.Really thank you! Want more.

Good write-up, I am regular visitor of oneˇ¦s site, maintain up the nice operate, and It's going to be a regular visitor for a long time.

Amazing. I had a bunch of DM's piling up and i completely forgot about SocialOomph. Heading there now to clean out that mess of an inbox!
Nick recently posted..Blending German and American Christmas Traditions

my goal is to finish the baby quilt I started two weeks ago. I have to genuinely push myself because this is finals week and my brains are mush!

What is Facebook?

Hi there. Very nice website!! Guy .. Excellent .. Wonderful .. I'll bookmark your site and take the feeds also...I am satisfied to locate so much useful info here within the post. Thanks for sharing.

I¡¦ll immediately seize your rss feed as I can't in finding your e-mail subscription link or newsletter service. Do you've any? Kindly permit me know so that I may just subscribe. Thanks.

What have one never finishes his apprenticeship learned. by Koi

Your penning manner is pleasing and the way you managed the subject with grace is commendable. I'm intrigued, I presume you are an expert on this subject. I just sign up for your RSS feed. :)

I truly enjoy reading through on this internet site , it holds fantastic blog posts. "The secret of eternal youth is arrested development." by Alice Roosevelt Longworth.

Please let me know if you're looking for a writer for your blog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I'd really like to write some articles for your blog in exchange for a link back to mine. Please shoot me an e-mail if interested. Thanks!

This will be a great web page, might you be involved in doing an interview about just how you designed it? If so e-mail me!

I have often stated you'll find far more Z28s and SS anythings than GM ever built.Growing up in that era i witnessed almost certainly 90% of them thrashed and totaled right before they began to rust absent.Cant even recall how a lot of instances id found a 70 1/2 camaro with all the center on the bumper hacksawed out by some idiot who claimed it absolutely was a Z.br /The numbers matching tends to make me laugh too due to the fact the 396 was a grenade and in case you had been fortunate the rod only went thru the oil pan.Chevy applied truck blocks as the warranty replacement thru the 402 days.In auto parts days we always checked the rats that arrived in as cores and under no circumstances observed an original code on any of them-we had men offering bounties on the serious kinds.

Simply wanna admit that this is very helpful , Thanks for taking your time to write this.

I think you have mentioned some very interesting details , appreciate it for the post.

I really appreciate this post. I've been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thanks again!

Hello, i really enjoy watching your blog. I like the way its put together, and totally dig the topic. Is there any way to subscribe to your site?

Totally agree with you, about a week ago wrote about the same in my blog..!

Thanks for helping out, great information. "A man will fight harder for his interests than for his rights." by Napoleon Bonaparte.

Post a comment