Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1525636
  • 博文数量: 289
  • 博客积分: 11086
  • 博客等级: 上将
  • 技术积分: 3291
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-22 17:06
个人简介

徐小玉的博客。

文章分类

全部博文(289)

文章存档

2023年(6)

2022年(1)

2021年(2)

2020年(9)

2019年(9)

2018年(6)

2017年(10)

2016年(10)

2014年(3)

2013年(4)

2011年(12)

2010年(16)

2009年(14)

2008年(119)

2007年(48)

2006年(20)

我的朋友

分类:

2008-03-12 11:03:42

#!/usr/bin/perl -w
use strict;
 my $data=int(rand(50));
 my $time=0;
 my $biggertime=0;
 my $smallertime=0;
 
 print "please input the data:\n";
 my $input=;
 chomp($input);
 
#AARONVOX:
#while (1)
#{
    # do something
 #   my $xxx = <>;
 #   goto AARONVOX if $xxx =~ /Hello/;
#}
 AARONVOX:
 while ($input gt $data )
 {
    $biggertime+=1;
    print " the input is too LARGE ! please input again;\n";
      $input=;
     chomp($input);
    goto AARONVOX if $input gt $data;
     goto BARONVOX if $input lt $data;

 
  BARONVOX:
  while ($input lt $data )
 {
    $smallertime+=1;
     print " the input is too small ! please input again;\n";
     $input=;
     chomp($input);
     goto AARONVOX if $input gt $data;
     goto BARONVOX if $input lt $data;
}
 
    $time=$smallertime+$biggertime+1;
    print " the input it : $input,this rand is : $data   ,\n";
   
     print "your input times is $time:\n";
     print " Your input is bigger  has times : $biggertime\n ";
     print "your input is smaller has times :$smallertime\n";
阅读(1055) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~