原文发表在网易博客 2010-11-04 21:18:43 开始学习perl了,得多做题啊. (让我对perl感兴趣的是小羊驼书,呃这个就是羊驼了,不过怎么感觉跟网络上某个神兽很像啊.) 2.1-2.3 计算圆半径计算 #!perl -w $PI=3.141592654; print "ENTER the semidiameter:"; $semidiameter = <STDIN> ; chomp($semidiameter); if ($semidiameter < 0 ){ $semidiameter=0; } $circumference=2*$PI*$semidiameter; print "circumference is $circumference"; 2.4计算两个数字的积 #!perl -w print "Enter the first number(a):"; chomp($a=<STDIN>); print "Enter the second number(b):"; chomp($b=<STDIN>); $c=$a*$b; print "a*b is $c"; 2.5 将某个字符串打印一定次数 #!perl -w print "Enter the character to print:"; chomp($string_to_print=<STDIN>); print "Enter times to print:"; chomp($times=<STDIN>); $result=${string_to_print} x $times; print "result is :$result"; 2011-05-25 22:33 感谢大家的鼓励,这篇文章发表在网易博客上之后有人回复我哦.
|
请发表评论