Perl语言入门(第四版)习题答案.docxVIP

  • 3
  • 0
  • 约1.85千字
  • 约 3页
  • 2021-11-26 发布于江苏
  • 举报
chomp($r=STDIN); chomp($r=STDIN); 《Perl 语言入门习题答案》 2.12 练习 1、写一个程序,计算半径为12.5的圆的周长。圆周长等于2π(π约为3.1415926)乘以半径。答案为78.5。 -----------------------/home/confish/perl/girth -----------------------/home/confish/perl/girth #!/usr/bin/perl -w #this program calculate a circles girth # $r=12.5; $g=12.5*2*3.1415; print the girth of the circle is $g\n; -----------------------/home/confish/perl/girth 2、修改上述程序,用户可以在程序运行时输入半径。如果,用户输入12.5,则应得到和上题一样的结果。 -----------------------/home/confish/perl/girthpro -----------------------/home/confish/perl/girthpro #!/usr/bin/perl -w #a better one to calculate girth # printen

文档评论(0)

1亿VIP精品文档

相关文档