jj03kan 发表于 2007-09-28 17:33

请指教!!谢谢

想从1930和1950之间取到乱数.该怎么写

str = ''
while str !='BYE'
   
    str = gets.chomp
   if str != str.upcase
      puts 'aaa'
    else
      if str == str.upcase and str != 'BYE'
      
         puts ('a' + rand(1930-1950) + '年CCCC')
      end
end
end
puts 'BYE BYE'

dz902 发表于 2007-09-28 18:16

1930 + rand(21):mrgreen:
页: [1]
查看完整版本: 请指教!!谢谢