关于数组的一些用法
来源:互联网 发布:淘宝专卖 编辑:程序博客网 时间:2024/05/16 04:43
下面的代码演示了关于数组的一些用法:
运行结果如下:
若把上面代码中的循环部分修改如下,亦可达到输出各元素的效果:
$s="how,are,you";
@array=split(/,/,$s);
$length=@array;
($t)=@array;
printf "The first element is %s ",$t;
printf "The first element is %s ",@array;
printf "The length of array is %d ",$length;
print "the elements are: ";
for($i=0;$i<$length;$i++)
{
printf "The $i is $array[$i] ";
}
@array=split(/,/,$s);
$length=@array;
($t)=@array;
printf "The first element is %s ",$t;
printf "The first element is %s ",@array;
printf "The length of array is %d ",$length;
print "the elements are: ";
for($i=0;$i<$length;$i++)
{
printf "The $i is $array[$i] ";
}
运行结果如下:
The first element is how
The first element is how
The length of array is 3
the elements are:
The 0 is how
The 1 is are
The 2 is you
The first element is how
The length of array is 3
the elements are:
The 0 is how
The 1 is are
The 2 is you
若把上面代码中的循环部分修改如下,亦可达到输出各元素的效果:
for($i=0;$i<@array;$i++)
{
printf "The $i is $array[$i] ";
}
{
printf "The $i is $array[$i] ";
}
- 关于数组的一些用法
- 关于java语言数组的一些简单用法
- 关于数组的用法
- 关于数组的用法
- 关于数组的一些问题
- 关于数组的一些小事
- 关于数组的一些操作
- 关于数组的一些方法
- 关于数组的一些总结
- 关于数组的一些应用
- 关于system()的一些用法
- 一些 关于 控件的用法
- 关于CListCtrl的一些用法
- 关于const的一些用法
- 关于struct的一些用法
- 关于AlertDialog 的一些用法
- 关于枚举的一些用法
- 关于Flurry的一些用法
- Type与Size
- 自建数据库表,并在ALV报表中直接向更新自建表中写数据范例(非常感谢JACK WU)
- CSS命名规则
- 缓冲区溢出原理浅析以及防护
- 很多人不清楚的20个windows XP秘密
- 关于数组的一些用法
- 用javascript做删除时的提示信息
- 华为面试题及答案
- VS2005的程序文件分发问题及解决
- chm 无法显示网页问题
- 入门:学习网页Web标准的五个步骤
- 初学:什么是DIV+CSS?有什么优势?
- 一些基本的命令往往可以在保护网络安全上起到很大的作用
- Python 3.0 抢“鲜”体验