国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
c#語法之ArryList
/*
*
*1,配置--修改電腦的系統(tǒng)環(huán)境參數(shù)
*我的電腦->內(nèi)容->高級->環(huán)境參數(shù)中的系統(tǒng)參數(shù)中的path后面加上";"號再加上"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"后這時候在cmd環(huán)境下就可以直接使用csc來編譯.
*
* Created by SharpDevelop.
* User: Administrator
* Date: 2008/8/26
* Time: 上午 08:48
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/

using System;
namespace Athrun
{
   
class Run
    {
       
static void Main()
        {
            Console.WriteLine(
"Hello World!");
        }
    }
}

 

 

Code
//數(shù)組的介紹
using System;
class Test
{
static void Main()
{
//數(shù)組的聲明方式
//int[] arr=new int[] {1,2,3};
int[] arr=new int[3];
arr[
0]=0;
arr[
1]=1;
arr[
2]=2;
//兩種不同的方式來讀取數(shù)組內(nèi)數(shù)組內(nèi)的元素
for (int i=0;i<arr.Length;i++)
System.Console.WriteLine(arr[i]);
//foreach(int i in arr)
//System.Console.WriteLine(i);
}
}

 

 

Code
//在方法內(nèi)對數(shù)組進(jìn)行操作
using System;
class Test
{
//一個靜態(tài)方法。根據(jù)所輸入的長度來建立一個一維數(shù)組,來進(jìn)行初始化以及在屏幕上打印數(shù)組元素
static void PrintArr(int ArrLength)
{
int[] arr=new int[ArrLength];
for (int i=0;i<arr.Length;i++)
arr[i]
=i;
Console.WriteLine(
"Print Array's value");
for (int i=0;i<arr.Length;i++)
Console.WriteLine(
"arr[{0}]={1}",i,arr[i]);
}
int i=1;
while (i>0)
{
Console.WriteLine(
"Please enter the array's Length:");
i
=Int32.Parse(Console.ReadLine());
PrintArr(i);
}
}

 

Code
//在另一個類中對數(shù)組進(jìn)行操作
using System;
class SetArray
{
   
public void PrintArr(int ArrLength)
    {
       
int[] arr=new int[ArrLength];
       
for (int i=0;i<arr.Length;i++)
            arr[i]
=i;
        Console.WriteLine(
"Print Array's value");
       
for (int i=0;i<arr.Length;i++)
            Console.WriteLine(
"arr[{0}]={1}",i,arr[i]);
    }
}
class Test
{
   
//Main()程序的入口方法
    static void Main()
    {
       
int i=1;
        SetArray arr
=new SetArray();
       
while (i>0)
        {
            Console.WriteLine(
"Please enter the array's Length:");
            i
=Int32.Parse(Console.ReadLine());
            arr.PrintArr(i);
        }
    }
}

 

 

Code
//ArrayList動態(tài)數(shù)組
using System;
using System.Collections;
class Athrun
{
static void Main()
{
ArrayList arr
=new ArrayList();
string str1;
while(true)
{
Console.WriteLine(
"Please add a string to ArrayList:");
str1
=Console.ReadLine();
if(str1=="end")
break;
arr.Add(str1);
Console.WriteLine();
for (int i=0;i<arr.Count;i++)
Console.Write(
"{0} ",arr[i]);
Console.WriteLine(
"\n");
}
}
}

 

 

Code
//下面的例子是打印一個一維數(shù)據(jù)矩陣
using System;
using System.Collections;
class Matrix
{
static void Main()
{
int[,] arr=new int[4,6];
for(int i=0;i<4;i++)
{
for(int j=0;j<6;j++)
{
arr[i,j]
=(i+1)*10+j+1;
}
}
for (int i=0;i<4;i++)
{
for(int j=0;j<6;j++)
{
Console.Write(
"{0} ",arr[i,j]);
}
Console.WriteLine();
}
}
}
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
4.1 順序查找算法
C# bubble sort,selection sort,insertion sort
c#學(xué)習(xí)體會:使用 ref 和 out 傳遞數(shù)組->>網(wǎng)頁教學(xué)網(wǎng)(http://www.w...
經(jīng)典算法題每日演練——第十題 樹狀數(shù)組
2015面試準(zhǔn)備03
給數(shù)組擴(kuò)容的幾種方式
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服