10 2012 档案

摘要:puts "\ninput a number:"number = getsnumber = number.to_ibegin puts "\ninput a base (min is 2 and max is 10):" base = gets base = base.to_iend while base < 2 or base >10result = 0i = 0while number/base != 0 do remainder = number % base result += remainder * 10**i i += 1 num 阅读全文
posted @ 2012-10-25 22:10 呆头鱼 阅读(686) 评论(0) 推荐(0)
摘要:1,ruby语言:"haixing".each_char { |c| print c, "\n" }2,python语言:for i in "haixing" : print i3,php语言:foreach( str_split("haixing") as $char ) echo $char, "\n";4,C语言:#include <stdio.h>char name[] = "haixing";void main() { int i; for(i=0; i 阅读全文
posted @ 2012-10-19 18:36 呆头鱼 阅读(473) 评论(0) 推荐(0)