C语言转换为VB.NET

发布网友 发布时间:2022-04-23 21:19

我来回答

3个回答

热心网友 时间:2023-07-18 00:19

Option Explicit On
Option Strict On
Imports System
Mole Program
Sub Main()
Dim y,m,t As Integer
begin:
' 输入数据时一行一个
y=CInt(Console.ReadLine())
m=CInt(Console.ReadLine())
t=CInt(Console.ReadLine())
If y
200 Then
Console.WriteLine("ERROR")
goto begin
End If
pr(y,m,t)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Function pr(y As Integer,m As Integer,t As Integer) As Integer
Dim ye,[Me],i As Integer
ye=CInt((m+t-2)/12+y)
[Me]=(m+t-2) Mod 12+1

End If
End Function
Function mday(y As Integer,m As Integer) As Integer
Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}
Dim ad As I追问这个不是吧

热心网友 时间:2023-07-18 00:19

Option Explicit On
Option Strict On

Imports System

Mole Program

Dim crc16_ccitt_table() As UShort={ _
&H0000, &H11, &H2312, &H329b, &H4624, &H57ad, _
&H6536, &H74bf, &H8c48, &H9dc1, &Haf5a, &Hbed3, _
&Hca6c, &Hdbe5, &He97e, &Hf8f7, &H1081, &H0108, _
&H3393, &H221a, &H56a5, &H472c, &H75b7, &H3e, _
&H9cc9, &H8d40, &Hbfdb, &Hae52, &Hdaed, &Hcb, _
&Hf9ff, &He876, &H2102, &H308b, &H0210, &H1399, _
&H6726, &H76af, &H4434, &H55bd, &Had4a, &Hbcc3, _
&H8e58, &H9fd1, &Heb6e, &Hfae7, &Hc87c, &Hd9f5, _
&H3183, &H200a, &H1291, &H0318, &H77a7, &H662e, _
&H54b5, &H453c, &Hbdcb, &Hac42, &H9ed9, &H8f50, _
&Hfbef, &Hea66, &Hd8fd, &Hc974, &H4204, &H538d, _
&H6116, &H709f, &H0420, &H15a9, &H2732, &H36bb, _
&Hce4c, &Hdfc5, &Hed5e, &Hfcd7, &H8868, &H99e1, _
&Hab7a, &Hbaf3, &H5285, &H430c, &H7197, &H601e, _
&H14a1, &H0528, &H37b3, &H263a, &Hdecd, &Hcf44, _
&Hfddf, &Hec56, &H98e9, &H60, &Hbbfb, &Haa72, _
&H6306, &H728f, &H4014, &H519d, &H2522, &H34ab, _
&H0630, &H17b9, &Hef4e, &Hfec7, &Hcc5c, &Hddd5, _
&Ha96a, &Hb8e3, &H8a78, &H9bf1, &H7387, &H620e, _
&H5095, &H411c, &H35a3, &H242a, &H16b1, &H0738, _
&Hffcf, &Hee46, &Hdcdd, &Hcd54, &Hb9eb, &Ha862, _
&H9af9, &H8b70, &H8408, &H9581, &Ha71a, &Hb693, _
&Hc22c, &Hd3a5, &He13e, &Hf0b7, &H0840, &H19c9, _
&H2b52, &H3adb, &H4e, &H5fed, &H6d76, &H7cff, _
&H94, &H8500, &Hb79b, &Ha612, &Hd2ad, &Hc324, _
&Hf1bf, &He036, &H18c1, &H0948, &H3bd3, &H2a5a, _
&H5ee5, &H4f6c, &H7df7, &H6c7e, &Ha50a, &Hb483, _
&H8618, &H9791, &He32e, &Hf2a7, &Hc03c, &Hd1b5, _
&H2942, &H38cb, &H0a50, &H1bd9, &H6f66, &H7eef, _
&H4c74, &H5dfd, &Hb58b, &Ha402, &H9699, &H8710, _
&Hf3af, &He226, &Hd0bd, &Hc134, &H39c3, &H284a, _
&H1ad1, &H0b58, &H7fe7, &H6e6e, &H5cf5, &H4d7c, _
&Hc60c, &Hd785, &He51e, &Hf497, &H8028, &H91a1, _
&Ha33a, &Hb2b3, &H4a44, &H5bcd, &H6956, &H78df, _
&H0c60, &H1de9, &H2f72, &H3efb, &Hd68d, &Hc704, _
&Hf59f, &He416, &H90a9, &H8120, &Hb3bb, &Ha232, _
&H5ac5, &H4b4c, &H79d7, &H685e, &H1ce1, &H0d68, _
&H3ff3, &H2e7a, &He70e, &Hf687, &Hc41c, &Hd595, _
&Ha12a, &Hb0a3, &H8238, &H93b1, &H6b46, &H7acf, _
&H4854, &H59dd, &H2d62, &H3ceb, &H0e70, &H1ff9, _
&Hf78f, &He606, &Hd49d, &Hc514, &Hb1ab, &Ha022, _
&H92b9, &H8330, &H7bc7, &H6a4e, &H58d5, &H495c, _
&H3de3, &H2c6a, &H1ef1, &H0f78}

Function do_crc_table_1(pData As Byte(),nLength As Integer) As UShort
Dim fcs As UShort=&Hffff
Dim i As Integer=0

While nLength>0
fcs=(fcs>>8) Xor crc16_ccitt_table((fcs Xor pData(i)) And &Hff)
nLength-=1
i+=1
End While
Return Not fcs
End Function

Sub Main()
'测试
Dim data As Byte()={ _
&H00,&H36,&H70,&H00,&H00,&H00,&H01, _
&H06,&H00,&H33,&H00,&H12,&H5C,&H4A, _
&H7E,&HC7,&H0A,&H00,&H16,&H02,&H7B, _
&H65,&H59,&H0C,&H45,&HC9,&HF6,&H00, _
&H14,&H00,&H00,&H36,&H00,&H07,&H01, _
&H00,&H00,&H00,&H00,&H00,&H01,&H00, _
&H36,&H00,&H07,&H02,&H00,&H00,&H00, _
&H00,&H00,&H00,&H01,&H7C}
Dim r As UShort=do_crc_table_1(data,data.Length)
Console.WriteLine("{0:X}",r)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
'测试
End Sub
End Mole

热心网友 时间:2023-07-18 00:20

这个我有vb6.0的算法,vb.net应该稍微修改下就好了追问00 36 70 00 00 00 01 06 00 33 00 12 5C 4A 7E C7 0A 00 16 02 7B 65 59 0C 45 C9 F6 00 14 00 00 36 00 07 01 00 00 00 00 00 01 00 36 00 07 02 00 00 00 00 00 00 01 7C
CRC校验值 : B313
这个你看下对不对

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com