成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

vb.net數(shù)組輸出 vb怎么輸出數(shù)組

vb.net變成 數(shù)組組合情況輸出問題

using System;

我們一直強(qiáng)調(diào)成都網(wǎng)站制作、成都做網(wǎng)站、外貿(mào)營銷網(wǎng)站建設(shè)對于企業(yè)的重要性,如果您也覺得重要,那么就需要我們慎重對待,選擇一個(gè)安全靠譜的網(wǎng)站建設(shè)公司,企業(yè)網(wǎng)站我們建議是要么不做,要么就做好,讓網(wǎng)站能真正成為企業(yè)發(fā)展過程中的有力推手。專業(yè)網(wǎng)絡(luò)公司不一定是大公司,創(chuàng)新互聯(lián)公司作為專業(yè)的網(wǎng)絡(luò)公司選擇我們就是放心。

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication42

{

class Program

{

static void Main(string[] args)

{

count = 0;

String[] s = Console.ReadLine().Split(' ');

int[] array = new int[s.Length];

for (int i = 0; i s.Length; i++)

{

array[i] = Convert.ToInt32(s[i]);

}

int m = Convert.ToInt32(Console.ReadLine());

Listint arraylist = new Listint();

arraylist.AddRange(array);

Output(arraylist, m, null);

Console.WriteLine("共有" + count.ToString() + "個(gè)");

Console.ReadKey();

}

static int count = 0;

static void Output(Listint array, int m, Listint output)

{

if (output == null)

output = new Listint();

if (m == 0)

{

for (int i = 0; i output.Count; i++)

{

Console.Write(output[i].ToString() + " ");

}

Console.Write("\r\n");

count++;

return;

}

else

{

for (int i = 0; i array.Count; i++)

{

Listint output2 = new Listint();

output2.AddRange(output.ToArray());

output.Add(array[i]);

Listint array2 = new Listint();

array2.AddRange(array.ToArray());

for (int j = 0; j = i; j++)

{

int number = array[j];

array2.Remove(number);

}

Output(array2, m - 1, output);

output.Clear();

output.AddRange(output2.ToArray());

}

}

}

}

}

額,沒注意VB,用C#寫的。。。

輸出了的,你新建一個(gè)C#控制臺(tái)程序,把這段貼進(jìn)去,運(yùn)行一下就知道了

先輸入一組字符串,然后輸入一個(gè)整數(shù),就會(huì)把所有的組合輸出出來

我把這段轉(zhuǎn)成VB再發(fā)一次吧

Module Module1

Sub Main()

count = 0

Dim s As String() = Console.ReadLine().Split(" ")

Dim array(0 To s.Length - 1) As Integer

For i As Integer = 0 To s.Length - 1

array(i) = Convert.ToInt32(s(i))

Next

Dim m As Integer = Convert.ToInt32(Console.ReadLine())

Dim arraylist As New List(Of Integer)

arraylist.AddRange(array)

Print(arraylist, m, Nothing)

Console.WriteLine("共有" + count.ToString() + "個(gè)")

Console.ReadKey()

End Sub

Sub Print(ByRef array As List(Of Integer), ByVal m As Integer, ByRef output As List(Of Integer))

If output Is Nothing Then

output = New List(Of Integer)()

End If

If m = 0 Then

For i As Integer = 0 To output.Count - 1

Console.Write(output(i).ToString() + " ")

Next

Console.Write(vbCrLf)

count = count + 1

Return

Else

For i As Integer = 0 To array.Count - 1

Dim array2 As New List(Of Integer)

Dim output2 As New List(Of Integer)

output2.AddRange(output.ToArray())

output.Add(array(i))

array2.AddRange(array.ToArray())

For j As Integer = 0 To i

Dim number As Integer = array(j)

array2.Remove(number)

Next

Print(array2, m - 1, output)

output.Clear()

output.AddRange(output2.ToArray())

Next

End If

End Sub

Dim count As Integer = 0

End Module

vb.net輸出數(shù)組

1.你說的這個(gè)有點(diǎn)問題,是要只輸出一次,也可做,

2.但問題是如果你數(shù)組還有就看不到了!這個(gè)做法有點(diǎn)問題

1.解決方法:

循環(huán)前面加入一個(gè)變量 dim Temp as Double=0

For i = 0 To 9

If score(i) avg and score(i)temp Then

TextBox3.Text = TextBox3.Text score(i) " "

if score(i)=avg then

temp=score(i)

end if

End If

Next

VB.net 數(shù)組怎么按任意元素的順序排序輸出

你直接傳一個(gè)數(shù)組進(jìn)去,而且是一個(gè)結(jié)構(gòu)體數(shù)組,array.sort怎么知道根據(jù)結(jié)構(gòu)中的哪一個(gè)屬性進(jìn)行排序?放一個(gè)c#的代碼你看看,VB和C#很相似的

class Program

{

static void Main(string[] args)

{

People[] p = new People[3]

{

new People{name="張三"},

new People{name="李四"},

new People{name="張二名"}

};

//重點(diǎn)傳一個(gè)實(shí)現(xiàn)了IComparer接口的類進(jìn)去,告訴Array.Sort怎么排序

Array.Sort(p, new PeopleCompare());

foreach (var item in p)

{

Console.WriteLine(item.name);

}

Console.ReadKey();

}

}

//People結(jié)構(gòu)體,換成類一樣的

public struct People

{

public string name { get; set; }

}

//實(shí)現(xiàn)了IComparer接口的類

public class PeopleCompare : IComparer

{

public int Compare(object x, object y)

{

People p1 = (People)x ;

People p2 = (People)y;

return p1.name.CompareTo(p2.name);

}

}

在VB.net中,如何使幾個(gè)數(shù)組變量按照列表示出來,并輸出到指定的EXCEL表格中!

先在: My Project 中引用 Microsoft Excel 11.0 Object Library(這個(gè)是Excel 2003,Excel 2007 是12.0),之后在窗體代碼中加入相關(guān)內(nèi)容就行了。以下是一個(gè)窗體的簡單實(shí)例

假設(shè)在C盤根文件夾中有:TEST.xls

Public Class 引用EXCEL窗體

Private A() As String = {"A", "B", "CC", "C", "D"}

Private B() As Integer = {1, 22, 34, 50, 16, 99, 14}

Private excelapp As New Microsoft.Office.Interop.Excel.Application

Private excelworkbook As Microsoft.Office.Interop.Excel.Workbook

Private Sub 引用EXCEL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim Index As Integer

excelworkbook = excelapp.Workbooks.Open("c:\test.xls")

excelapp.Application.Workbooks.Add(True)

excelapp.Cells(1, 1) = "數(shù)組:A"

For Index = 0 To UBound(A)

excelapp.Cells(Index + 2, 1) = A(Index)

Next

excelapp.Cells(1, 2) = "數(shù)組:B"

For Index = 0 To UBound(B)

excelapp.Cells(Index + 2, 2) = B(Index)

Next

excelapp.Visible = True

End Sub

End Class

運(yùn)行結(jié)果:

數(shù)組:A 數(shù)組:B

A 1

B 22

CC 34

C 50

D 16

99

14

網(wǎng)站欄目:vb.net數(shù)組輸出 vb怎么輸出數(shù)組
網(wǎng)站路徑:http://jinyejixie.com/article22/dossgcc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、App開發(fā)、網(wǎng)站維護(hù)、定制開發(fā)、網(wǎng)站策劃、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作
昌图县| 荥经县| 禄丰县| 沙湾县| 阜城县| 马边| 富蕴县| 永德县| 三亚市| 金平| 红河县| 扶沟县| 彩票| 三亚市| 锡林郭勒盟| 峨眉山市| 上犹县| 航空| 揭西县| 临江市| 三亚市| 昭苏县| 绍兴市| 舞钢市| 禄丰县| 酒泉市| 怀来县| 普兰店市| 扶沟县| 西昌市| 波密县| 安西县| 清镇市| 云安县| 靖安县| 土默特右旗| 中牟县| 安图县| 林西县| 嘉黎县| 泰州市|