码迷,mamicode.com
首页 >  
搜索关键字:puts    ( 2099个结果
Ruby-方法
#方法 defhelloworld puts"HelloWorld!" end helloworld #带参数的方法 defhello(name) puts"Hello#{name}" end hello("World!") hello("Ruby") #带可变长参数的方法 defhello(*name) name.each{|x|puts"Hello#{x}"}#each迭代器将name的值传递给x end hello("zhao","wang","l..
分类:其他好文   时间:2016-05-18 22:13:06    阅读次数:233
Ruby-条件判断
=begin 条件判断语句包括if语句,unless语句,case语句, =end #if语句 =begin if条件then 处理1 elsif条件2then 处理2 else 处理3 end =end a=10 b=20 ifa>b puts"abiggerthanb" elsifa<b puts"asmallerthanb" else puts"aisequaltob" end puts"abiggerthanb"ifa>b ..
分类:其他好文   时间:2016-05-18 22:12:44    阅读次数:203
Ruby-迭代器
#迭代器 5.times{puts"HelloWoeld!"}#连续输出4次HelloWorld! 1.upto(10){|i|puts"Thecountis#{i}"}#从1数到10 10.downto(1){|i|puts"Thecountis#{i}"}#从10到1 1.step(10,2){|i|puts"Thecountis#{i}"}#从1到10,步长为2 #each,使用each方法将集合内的对象逐个取出 name=["..
分类:其他好文   时间:2016-05-18 22:12:28    阅读次数:189
Ruby-循环
=begin 循环,times,while,each,for,until,loop =end #times方法 =begin 循环次数.timesdo 循环的处理 end 循环的次数.times{ 循环的处理 } =end 5.timesdo puts"hello" end 5.times{|i| puts"for#{i}‘sloop" } #for语句 =begin for变量in对象do 循环的处理 end =end sum=0 ..
分类:其他好文   时间:2016-05-18 22:11:59    阅读次数:325
ruby关于flip-flop理解上一个注意点
上面的flip-flop的用法,你可以理解成 将 大于等于5和小于等于10的数字打印出来,也就是理解成 puts x if x >=5 && x <=10 ,但是注意你不能写成下面这样 如果写成绿色背景的代码,就会造成输出 大于等于5 小于等于20的数字 问题2 flip-flop的用法 在普通的判 ...
分类:其他好文   时间:2016-05-18 12:29:18    阅读次数:183
gets() fgets() puts() fputs()
View Code ...
分类:其他好文   时间:2016-05-18 09:15:18    阅读次数:138
getchar() getch() getche() gets() puts() scanf()的用法及区别
getchar() putchar(ch) scanf() 头文件stdio.h getch() getche() 头文件conio.h gets() puts() 头文件stdio.h getch()和getche()函数 都是从键盘上读入一个字符,但getch()函数不将读入的字符回显在显示屏幕 ...
分类:其他好文   时间:2016-05-15 12:28:09    阅读次数:228
poj 2318 叉积的应用+二分
Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when he is finished playing with t...
分类:其他好文   时间:2016-05-13 03:07:08    阅读次数:166
spd.从DIMM内存条I2C设备移植到扣板NOR_FLASH
在 /board/freescale/t104xrdb/ddr.c文件的initdram函数中 phys_size_t initdram(int board_type) {     phys_size_tdram_size;   #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)     puts("Initial...
分类:其他好文   时间:2016-05-13 02:36:40    阅读次数:383
CodeForces 673D Bear and Two Paths(构造)
思路:构造,显然是一个蝴蝶形状的图 #include using namespace std; int main() { int n,k,a,b,c,d; vectorg; scanf("%d%d",&n,&k); scanf("%d%d%d%d",&a,&b,&c,&d); if(n==4) { puts("-1"); return 0; } if (k<=n...
分类:其他好文   时间:2016-05-12 14:38:18    阅读次数:182
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!