欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vb.net常用算法,vb函數(shù)運(yùn)算

VB.NET數(shù)組的排序法?

如果你是從vb6剛過渡上vb。net,建議還是用冒泡排序法,容易理解。

為朝陽縣等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及朝陽縣網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站建設(shè)、成都網(wǎng)站制作、朝陽縣網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!

如果你正努力學(xué)習(xí)vb。net的方法,推薦一個例子如下:

Imports System

Imports System.Collections

Public Class SamplesArray

Public Class myReverserClass

Implements IComparer

' Calls CaseInsensitiveComparer.Compare with the parameters reversed.

Function Compare(x As Object, y As Object) As Integer _

Implements IComparer.Compare

Return New CaseInsensitiveComparer().Compare(y, x)

End Function 'IComparer.Compare

End Class 'myReverserClass

Public Shared Sub Main()

' Creates and initializes a new Array and a new custom comparer.

Dim myArr As [String]() = {"The", "QUICK", "BROWN", "FOX", "jumps", "over", "the", "lazy", "dog"}

Dim myComparer = New myReverserClass()

' Displays the values of the Array.

Console.WriteLine("The Array initially contains the following values:")

PrintIndexAndValues(myArr)

' Sorts a section of the Array using the default comparer.

Array.Sort(myArr, 1, 3)

Console.WriteLine("After sorting a section of the Array using the default comparer:")

PrintIndexAndValues(myArr)

' Sorts a section of the Array using the reverse case-insensitive comparer.

Array.Sort(myArr, 1, 3, myComparer)

Console.WriteLine("After sorting a section of the Array using the reverse case-insensitive comparer:")

PrintIndexAndValues(myArr)

' Sorts the entire Array using the default comparer.

Array.Sort(myArr)

Console.WriteLine("After sorting the entire Array using the default comparer:")

PrintIndexAndValues(myArr)

' Sorts the entire Array using the reverse case-insensitive comparer.

Array.Sort(myArr, myComparer)

Console.WriteLine("After sorting the entire Array using the reverse case-insensitive comparer:")

PrintIndexAndValues(myArr)

End Sub 'Main

Public Shared Sub PrintIndexAndValues(myArr() As [String])

Dim i As Integer

For i = 0 To myArr.Length - 1

Console.WriteLine(" [{0}] : {1}", i, myArr(i))

Next i

Console.WriteLine()

End Sub 'PrintIndexAndValues

End Class 'SamplesArray

'This code produces the following output.

'

'The Array initially contains the following values:

' [0] : The

' [1] : QUICK

' [2] : BROWN

' [3] : FOX

' [4] : jumps

' [5] : over

' [6] : the

' [7] : lazy

' [8] : dog

'

'After sorting a section of the Array using the default comparer:

' [0] : The

' [1] : BROWN

' [2] : FOX

' [3] : QUICK

' [4] : jumps

' [5] : over

' [6] : the

' [7] : lazy

' [8] : dog

'

'After sorting a section of the Array using the reverse case-insensitive comparer:

' [0] : The

' [1] : QUICK

' [2] : FOX

' [3] : BROWN

' [4] : jumps

' [5] : over

' [6] : the

' [7] : lazy

' [8] : dog

'

'After sorting the entire Array using the default comparer:

' [0] : BROWN

' [1] : dog

' [2] : FOX

' [3] : jumps

' [4] : lazy

' [5] : over

' [6] : QUICK

' [7] : the

' [8] : The

'

'After sorting the entire Array using the reverse case-insensitive comparer:

' [0] : the

' [1] : The

' [2] : QUICK

' [3] : over

' [4] : lazy

' [5] : jumps

' [6] : FOX

' [7] : dog

' [8] : BROWN

vb.net 排列組合算法

看了你說遞歸的效率低。那么你可以不用的。

給出的方法就是先生成第一個排列,然后每次調(diào)用下面的函數(shù)給出下一個排列,這樣生成的效率很高,這個函數(shù)可以內(nèi)聯(lián)。

這個是很經(jīng)典的排列組合算法啊?在網(wǎng)上能搜到一大堆。

大概是那種帶指向的移動的算法。我給你搜一個吧。

我找了幾個,這個是我覺得說的比較清楚的,你可以仔細(xì)參考一下,看不懂的話再搜點(diǎn)別的好了。。

全排列的算法跟這個不太一樣的。需要有點(diǎn)改動的。

至于語言的話,應(yīng)該不會有太大問題吧。。basic版的確實(shí)比較少,現(xiàn)在我也比較懶不想動手寫。。還是要靠你自己啦。

★生成排列的算法:

比如要生成5,4,3,2,1的全排列,首先找出一個最小的排列12345, 然后依次調(diào)用n!次STL算法中的next_permutation()即可輸出所有的全排列情況。所以這種算法的細(xì)節(jié)就是STL algorithm中next_permutation()的實(shí)現(xiàn)機(jī)制。詳細(xì)的實(shí)現(xiàn)代碼,大伙可以參考侯捷的《STL源代碼剖析》,在這里我只說一下我的理解:

1 首先從最尾端開始往前尋找兩個相鄰元素,令第一個元素為*i,第二個元素為*ii,且滿足*i*ii,找到這樣一組相鄰的元素后。

2 再從最尾端開始往前檢驗(yàn),找出第一個大于*i的元素,令為*k,將i,k元素對調(diào)。

3 再將ii及ii之后的所有元素顛倒排列,此即所求之"下一個"排列。

prev_permutation()算法的思路也基本相同,只不過它們尋找的"拐點(diǎn)"不同,在next_permutation()算法中尋找的是峰值拐點(diǎn),而在prev_permutation()算法中尋找的是谷值拐點(diǎn)。另外,在第二步中,prev_permutation()要找的是第一個小于*i的元素而不是第一個大于*i的元素。

具體例子,有空再舉,現(xiàn)在時間太晚了:)

★生成組合的算法:

如下面截圖所示,分全組合和r-組合兩種情況。

這里有一段核心代碼:

//--------------------------------------------------------

// Generate next combination (algorithm from Rosen p. 286)

//--------------------------------------------------------

public int[] getNext () {

if (numLeft.equals (total)) {

numLeft = numLeft.subtract (BigInteger.ONE);

return a;

}

int i = r - 1;

while (a[i] == n - r + i) {

i--;

}

a[i] = a[i] + 1;

for (int j = i + 1; j r; j++) {

a[j] = a[i] + j - i;

}

numLeft = numLeft.subtract (BigInteger.ONE);

return a; //這里返回的a數(shù)組,存儲的就是下標(biāo)的排列組合。

}

到這里,也許大伙會有一個疑問,假如要求的不是數(shù)字的排列組合,而是字符或字符串的排列組合呢?怎么辦?其實(shí)很簡單,你只要拿數(shù)組的下標(biāo)來做排列組合,返回他們下標(biāo)的排列組合,然后再到原數(shù)組中讀取字符串值,就可以輸出全部的排列組合結(jié)果。

加密解密高手進(jìn)!VB.NET 誰能給一個MD5或其他的加密算法

注意參數(shù),Text是密文。sKey是你的加密干擾符

Public Shared Function Decrypt(ByVal Text As String, ByVal sKey As String) As String

Dim provider As New DESCryptoServiceProvider()

Dim num As Integer = Text.Length \ 2

Dim buffer As Byte() = New Byte(num - 1) {}

For i As Integer = 0 To num - 1

Dim num3 As Integer = Convert.ToInt32(Text.Substring(i * 2, 2), H10)

buffer(i) = CByte(num3)

Next

provider.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))

provider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))

Dim stream As New MemoryStream()

Dim stream2 As New CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write)

stream2.Write(buffer, 0, buffer.Length)

stream2.FlushFinalBlock()

Return Encoding.[Default].GetString(stream.ToArray())

End Function

求vb.net的哈希加密算法的代碼?

病情分析:

你好!

你懷孕31周,已經(jīng)屬于孕晚期了,這個時期,胎動頻繁是比較正常的現(xiàn)象。如果懷孕月份再大一些,胎動就不會這么明顯了。你的寶寶動得很利害,這與你的往哪邊睡沒有特別大的關(guān)系的。正好相反,你往左側(cè)睡時,胎盤血液循環(huán)較好,胎兒感覺比較舒服,才會在子宮內(nèi)活動。

指導(dǎo)意見:

在懷孕晚期,原則上應(yīng)該多往左側(cè)睡,以利于胎盤的血液循環(huán),對于胎兒有利。但是,如果你感覺左側(cè)睡胎動明顯,那么,也可以換到右側(cè)睡或是平躺著睡,只要睡得舒服,怎么睡都可以的,并不要強(qiáng)求往哪一側(cè)睡。

建議你放松心情,平時可以自測胎動的,如果每小時大約3--5次,則為正常現(xiàn)象。如果感覺異常,還可以到醫(yī)院做胎心音監(jiān)測的。

祝你健康!

病情分析:

根據(jù)你說的情況,現(xiàn)在胎兒的反應(yīng)是正常的,沒有看出什么異常

指導(dǎo)意見:

胎兒每天也要適當(dāng)?shù)幕顒拥模阅悴灰獡?dān)心,定期到醫(yī)院進(jìn)行孕檢就可以了

病情分析:

現(xiàn)在懷孕31周,左側(cè)睡是寶寶動的厲害,說明寶寶對于你這個姿勢很不舒服!

指導(dǎo)意見:

左側(cè)睡覺也會壓迫心臟的,所以你應(yīng)該選擇右側(cè)睡覺的,以寶寶最舒服的姿勢來睡覺!

VB.NET的陽歷與農(nóng)歷轉(zhuǎn)換的算法

根據(jù)經(jīng)驗(yàn), 這個算法非常復(fù)雜. 經(jīng)過查找,終于得到一些資料, 在此愿與大家分享。 首先陰歷以月為基本單位,一個月以新月出現(xiàn)的那一天為始直至下一個新月出現(xiàn)的前一天。 由于月亮公轉(zhuǎn)的周期介于29到30天之間,陰歷的一個月也就由新月出現(xiàn)時刻的早晚或是29天或是30天。 大月為30天,小月為29天。 與陽歷不同的是,大小月在不同的年中不固定。 如春節(jié)的前一天常稱為大年三十,但有不少年如2000年的陰歷十二月只有29天。 由于十二個月的時間較陽歷年即地球繞太陽公轉(zhuǎn)一周的時間短11天左右. 為了使陰歷年與陽歷年保持相對穩(wěn)定,每隔兩三年就需要加入一個閏月。 大約每十九年要加入七個閏月。 而二十四節(jié)氣則是由地球在繞太陽公轉(zhuǎn)的軌道上的位置確定的。 以每年的冬至為始,每15度為一個節(jié)氣。 是故二十四節(jié)氣在陽歷的每月中有大概固定的日期。 古時以二十四節(jié)氣指導(dǎo)農(nóng)耕,這就是陰歷又稱農(nóng)歷的原因。 其中陽歷下半月的十二個節(jié)氣又稱為中氣。 中氣出現(xiàn)的時刻和閏月的確定有直接的關(guān)系。 陰歷的計算有下列四條規(guī)則: 1.所有新月和節(jié)氣出現(xiàn)的時刻的計算以東經(jīng)120度即東八區(qū)標(biāo)準(zhǔn)時為準(zhǔn)。 但計算1929年以前的陰歷時應(yīng)以北京即東經(jīng)116度25分的當(dāng)?shù)貢r為準(zhǔn)。 2.新月出現(xiàn)的一天為一個月的第一天。 如某個節(jié)氣的出現(xiàn)時刻也在這一天,則不論該節(jié)氣的出現(xiàn)時刻是否比新月晚,一律算落入新的一個月中。 3.每年的冬至總是落在這年的十一月中。 從一年的冬至的第二天起到下一年冬至這一天止的這段時間稱為一歲。 如一歲中有十三個新月出現(xiàn),則這一歲為閏歲,要加入一個閏月。 4.閏歲中第一個沒有中氣的月為閏月。 因?yàn)橐粴q中只有十二個中氣,所以閏歲中至少有一個月沒有中氣,也存在有兩個月沒有中氣的可能性。 但這種情況下只有第一個沒有中氣的月為閏月。 閏月的前一個月為幾月則該閏月稱為閏幾月。 根據(jù)以上信息, 我們知道農(nóng)歷是根據(jù)天文觀測進(jìn)行指定的(也許可以在天文學(xué)的書上找到說明)。 為了簡化轉(zhuǎn)換計算, 很多程序人員設(shè)計了基于"時間段內(nèi)查表"方法的例程. 更具體的說明和源碼請參考下面這些資料:

求VB.NET的MD5算法調(diào)用

下面是完整的類,可以設(shè)置任意密碼

'DES及md5加密解密----添加引用中添加對system.web的引用。

Imports?System.Security.Cryptography

Imports?System

Imports?System.Text

Imports?System.Web

'''?summary

'''?DES加密類

'''?/summary

'''?remarks/remarks

Public?Class?DESEncrypt

Public?Sub?DESEncrypt()

End?Sub

Public?Shared?Function?Encrypt(ByVal?Text?As?String)?As?String

Return?Encrypt(Text,?"12345678")

End?Function

Public?Shared?Function?Encrypt(ByVal?Text?As?String,?ByVal?sKey?As?String)?As?String

Dim?des?As?New?DESCryptoServiceProvider()

Dim?inputByteArray?As?Byte()

inputByteArray?=?Encoding.Default.GetBytes(Text)

des.Key?=?ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey,?"md5").Substring(0,?8))

des.IV?=?ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey,?"md5").Substring(0,?8))

Dim?ms?As?New?System.IO.MemoryStream()

Dim?cs?As?New?CryptoStream(ms,?des.CreateEncryptor(),?CryptoStreamMode.Write)

cs.Write(inputByteArray,?0,?inputByteArray.Length)

cs.FlushFinalBlock()

Dim?ret?As?New?StringBuilder()

Dim?b?As?Byte

For?Each?b?In?ms.ToArray()

ret.AppendFormat("{0:X2}",?b)

Next

Return?ret.ToString()

End?Function

Public?Shared?Function?Decrypt(ByVal?Text?As?String)?As?String

Return?Decrypt(Text,?"12345678")

End?Function

Public?Shared?Function?Decrypt(ByVal?Text?As?String,?ByVal?sKey?As?String)?As?String

Dim?des?As?New?DESCryptoServiceProvider()

Dim?len?As?Integer

len?=?Text.Length?/?2

Dim?inputByteArray(len?-?1)?As?Byte

Dim?x,?i?As?Integer

For?x?=?0?To?len?-?1

i?=?Convert.ToInt32(Text.Substring(x?*?2,?2),?16)

inputByteArray(x)?=?CType(i,?Byte)

Next

des.Key?=?ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey,?"md5").Substring(0,?8))

des.IV?=?ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey,?"md5").Substring(0,?8))

Dim?ms?As?New?System.IO.MemoryStream()

Dim?cs?As?New?CryptoStream(ms,?des.CreateDecryptor(),?CryptoStreamMode.Write)

cs.Write(inputByteArray,?0,?inputByteArray.Length)

cs.FlushFinalBlock()

Return?Encoding.Default.GetString(ms.ToArray())

End?Function

End?Class

'以下是調(diào)用方法

Public?Class?Form1

Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click?'加密

Dim?str_Encrypt?As?String?=?DESEncrypt.Encrypt("你要加密的文本,可以是任意長度",?"密碼,可以很長,如果省略這個參數(shù)就是默認(rèn)的12345678")

End?Sub

Private?Sub?Button2_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button2.Click?'解密

Dim?str_Decrypt?As?String?=?DESEncrypt.Decrypt("你要解密的文本,?可以是任意長度",?"加密時用到的密碼,如果省略這個參數(shù)就是默認(rèn)的12345678")

End?Sub

網(wǎng)站標(biāo)題:vb.net常用算法,vb函數(shù)運(yùn)算
標(biāo)題URL:http://chinadenli.net/article18/dsejsdp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站網(wǎng)站策劃定制網(wǎng)站品牌網(wǎng)站制作關(guān)鍵詞優(yōu)化電子商務(wù)

廣告

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

成都網(wǎng)站建設(shè)公司