zoukankan      html  css  js  c++  java
  • 【Java】用五种语言写数组(用于自己学习)

    C语言

    #include<stdio.h>
    
    int main()
    {
        int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        int i;
        for(i=0;i<9;i++)
            printf("%d ",a[i]);
        printf("%d\n",a[9]);
            return 0;
    }

    C++

    #include <iostream>
    using namespace std;
    
    int main()
    {
        const int len = 6;
        int hours[len];
        cin >> hours[0];
        cin >> hours[1];
        cin >> hours[2];
        cin >> hours[3];
        cin >> hours[4];
        cin >> hours[5];
        cout << hours[0];
        cout << " " << hours[1];
        cout << " " << hours[2];
        cout << " " << hours[3];
        cout << " " << hours[4];
        cout << " " << hours[5] << endl;
        return 0;
    }

    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>
  • 相关阅读:
    hadoop目录命令
    spark简单文件配置
    git简单使用
    1
    环境
    spring boot入门学习---热部署
    浅谈-对modbus的理解
    springboot集成调用Azkaban
    搭建自己的maven私服 必过
    Spring Boot 出现 in a frame because it set 'X-Frame-Options' to 'DENY'
  • 原文地址:https://www.cnblogs.com/daijux/p/11889882.html
Copyright © 2011-2022 走看看