【Java】用五种语言写数组(用于自己学习)
2024-10-09 08:58:33
C语言
#include<stdio.h> int main()
{
int a[] = {, , , , , , , , , };
int i;
for(i=;i<;i++)
printf("%d ",a[i]);
printf("%d\n",a[]);
return ;
}
C++
#include <iostream>
using namespace std; int main()
{
const int len = ;
int hours[len];
cin >> hours[];
cin >> hours[];
cin >> hours[];
cin >> hours[];
cin >> hours[];
cin >> hours[];
cout << hours[];
cout << " " << hours[];
cout << " " << hours[];
cout << " " << hours[];
cout << " " << hours[];
cout << " " << hours[] << endl;
return ;
}
Python
array_full=[1, 2, 3]
print(array_full[0])
print(array_full[-1])
Java
package arr;
import java.util.Arrays;
public class arr {
public static void main(String[]args){
int[] a={1, 2, 3, 4, 5, 6, 7, 8};
int[] b=new int[4];
b=Arrays.copyOfRange(a,2,6);
System.out.println(Arrays.toString(b));
}
}
CSS
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>数组</title>
<script>
var name=["aaa","bbb","ccc"];
</script>
</head>
</html>
最新文章
- log4net 自定义Layout日志字段
- bzoj 3718
- java设计模式之命令模式
- NSOperation使用
- delphi 资源文件详解
- bjfu1262 优先队列
- Ehcache(2.9.x) - API Developer Guide, Cache Usage Patterns
- centos 6.5上部署jetty
- 贪心:字典树openjudge1799-最短前缀
- C# delegate event func action 匿名方法 lambda表达式
- CoreText精彩文字轮廓绘制动画的一点改进
- C++语言之静态变量的运用
- 搭建EOS未完
- ELF格式探析之三:sections
- 《Gradle权威指南》--Android Gradle多渠道构建
- [FreeMind] 绘制思维时遇到的常见问题解决办法
- 抓取分析网页批量下载评书(3)之批量下载mp3
- cookie 组成结构
- 法外之徒第一季/全集Braquo迅雷下载
- select元素添加option的add()方法 | try{}catch{}
热门文章
- C++ 顺序容器(vector,list、deque,stack,queue)
- JAVA 读取xml格式的数据
- mysql explain中key_len的作用
- java当中JDBC当中请给出一个Oracle DataSource and SingleTon例子
- 使用 Vagrant + VirtualBox 快速构建 CentOS 下的 Docker 环境
- 【MIT 6.824 】分布式系统 课程笔记(一)
- shell 学习笔记7-shell-函数
- tslint 忽略格式检查
- springboot_2
- 详解Spring Cloud中Hystrix 线程隔离导致ThreadLocal数据丢失