c++翻译成c#代码,翻译完毕直接给分。 [问题点数:40分,结帖人xjjrocker]

Bbs2
本版专家分:135
结帖率 100%
Bbs2
本版专家分:135
Bbs2
本版专家分:135
翻译-----VB.NET翻译C#
有谁可以帮我把下面的程序<em><em>翻译</em>成</em>C#啊!先谢谢了!rn Private Sub FindCheckTrue(ByVal tn As TreeNode) rn Dim t As TreeNode rn For Each t In tn.Nodes rn If t.Checked = True Then rn Dim clientID As String rn clientID = t.ID '遍历整个树,得到checked=true的节点id rn Response.Write(clientID & " ") '<> 0 Then rn FindCheckTrue(t) rn End If rn Next t rn End Sub 'FindCheckTrue rn rn Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click rn Dim i As Int32 rn For i = 0 To Me.TreeView1.Nodes.Count - 1 rn If (Me.TreeView1.Nodes(i).Checked = True) Then rn Response.Write(Me.TreeView1.Nodes(i).ID & " ") rn End If rn FindCheckTrue(Me.TreeView1.Nodes(i)) rn Next rn End Sub rn End Class
C语言代码翻译C#
rn 比如你收到的数据为:FF 55 04 62 00 02 23 8Brnrn typedef unionrn rn unsigned int Distance;rn structrn rn unsigned char Low;rn unsigned char Mid1;rn unsigned char Mid2;rn unsigned char High;rn rn Distacne_t;rnrnrnrn Distance_t Dist;rn Dist.High = 0x00;rn Dist.Mid2 = 0x00;rn Dist.Mid1 = 0x02;rn Dist.Low = 0x23;rn //Dist.Distance就是你想要的距离值rnrnrn <em><em>翻译</em>成</em>C#<em>代码</em>应该是什么?求教
c#代码 翻译vc++
[code=C#]rn这段是WM_MOUSE_LL响应函数里面的rn private void HookOnMouseActivity(object sener, HookEx.MouseExEventArgs e) rn Point location = e.Location;rnrn if (e.Button == MouseButtons.Left) rn Rectangle captionRect = new Rectangle(this.Location, new Size(this.Width, SystemInformation.CaptionHeight));rn if (captionRect.Contains(location)) rn SetWindowLong(this.Handle, GWL_EXSTYLE,rn (int)GetWindowLong(this.Handle, GWL_EXSTYLE) & (~WS_DISABLED));rn SendMessage(this.Handle, WM_SETFOCUS, IntPtr.Zero, IntPtr.Zero);rn else rn SetWindowLong(this.Handle, GWL_EXSTYLE,rn (int)GetWindowLong(this.Handle, GWL_EXSTYLE) | WS_DISABLED);rn rn rn rnrn[/code]rn<em><em>翻译</em>成</em>下面的vc++<em>代码</em>rnrn[code=C/C++]rng_hwnd 为我的程序的HWND 给值在我的dlg程序的 initdialog里面,g_hwnd=this->m_hWnd;rn//这段是WM_MOUSE_LL响应函数里面的rn if(nCode==HC_ACTION)rn rn if(wParam==WM_LBUTTONDOWN||wParam==WM_LBUTTONUP)rn rn CRect rectwindow;rn ::GetWindowRect(g_hwnd,&rectwindow);rnrn MSLLHOOKSTRUCT* msl = (MSLLHOOKSTRUCT *)lParam;rn if(rectwindow.PtInRect(msl->pt))rn rn SetWindowLong(g_hwnd, GWL_EXSTYLE,GetWindowLong(g_hwnd, GWL_EXSTYLE) & (~WS_DISABLED));rn SendMessage(g_hwnd, WM_SETFOCUS, 0, 0);rn rn elsern rn SetWindowLong(g_hwnd, GWL_EXSTYLE,GetWindowLong(g_hwnd, GWL_EXSTYLE)|WS_DISABLED);rn rn rn rn[/code]rn请问这样转换对不对,还有,this.handle 就是当前窗口的 HWND吧
C# 代码 翻译 delphi
请高手帮忙<em>翻译</em>下!谢谢!rn[code=csharp][StructLayout(LayoutKind.Sequential, Pack = 1)]rnclass SSR_Userrnrn public ushort PIN;rn public byte Privilege;rnrn [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]rn public byte[] Password = new byte[8];rn [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]rn public byte[] Name = new byte[24];rn [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]rn public byte[] Card = new byte[4];rn public byte Group;rn [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]rn public ushort[] TimeZones = new ushort[4];//the timezones that the user can usern [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]rn public byte[] PIN2 = new byte[24];rnrnpublic void GetSSRUserInfoFromDat(byte[] DataBuf, out int PIN, out int Privilege, out string Password,rn out string Name, out int Card, out int Group, out string TimeZone, out string PIN2)rn rn byte[] PasswordBuf = new byte[8];rn byte[] NameBuf = new byte[24];rn byte[] TimeZoneBuf = new byte[8];rn byte[] PIN2Buf = new byte[24];rn SSR_User ssruser = new SSR_User();rn ssruser = (SSR_User)Raw.RawDeserialize(DataBuf, typeof(3));rn PIN = ssruser.PIN;rn Privilege = ssruser.Privilege;rn Array.Copy(DataBuf, 3, PasswordBuf, 0, 8);rn Password = System.Text.Encoding.Default.GetString(PasswordBuf);//"default" is to read the system's current ANSI code page encodingrnrn Array.Copy(DataBuf, 11, NameBuf, 0, 24);rn Name = System.Text.Encoding.Default.GetString(NameBuf);rnrn Card = 0;rn for (int i = 35; i <= 38; i++)rn rn Card += Convert.ToInt32(DataBuf[i] * System.Math.Pow(16, 2 * (i - 35)));rn rn Group = ssruser.Group;rnrn Array.Copy(DataBuf, 40, TimeZoneBuf, 0, 8);rn TimeZone = System.Text.Encoding.Default.GetString(TimeZoneBuf);rnrn Array.Copy(DataBuf, 48, PIN2Buf, 0, 24);rn PIN2 = System.Text.Encoding.Default.GetString(PIN2Buf);rn [/code]
把C语言代码翻译C#语言
你好,感谢你阅读此帖.rnrn下面是一段通信协议中使用的CRC<em>代码</em>,用C语言编写的,现在请各位朋友帮我看看怎样才能把它转换成C#语言呢?rnrn[code=C/C++]UWORD calcrc(BYTE *ptr,BYTE count) rn rnUWORD crc;BYTE i,j; rnrncrc = 0;rnrnfor(j=0;j
翻译代码。c++ --> c#。立刻给分
int Str2Hex(char * str);rnrnchar * Convert(char * inFileName,char * outFilename )rnrn FILE * outFile,* inFile;rn int j;rn rn outFile=fopen(outFilename, "wb") ;rn char str[] = "0605041582000064F00000480E01";rn fputs( str , outFile );rnrn inFile=fopen(inFileName, "rb") ;rn int b;rnrn for( b = 0;b < 14;b++)rn rn fseek(inFile, 118 + 36*(13-b), SEEK_SET);rn if (inFile==NULL)rnrn if (inFile==NULL)rn cout;rnrnConvert(infilename, outfilename);rnrnreturn 0;rn
vb.net代码翻译c#
下面几句vb.net<em>代码</em>如何<em><em>翻译</em>成</em><em>c#</em>rnrn Dim resolved As IPHostEntryrnrn Dim name As String = ""rnrn If resolved IsNot Nothing Then name = """" & resolved.HostName & """ "rnrnrn
c#代码翻译vb.net的
mybutton.Command +=new CommandEventHandler(mybutton_Command);rnmybutton.CommandArgument = "mybutton"+x.ToString();rnrnprivate void mybutton_Command(object sender,CommandEventArgs e)rnrn //这里写处理的<em>代码</em>!rnrnrn上面的<em>代码</em>用vb.net怎么写??
c代码翻译delphi 代码
int __fastcall TMainForm::AscToBin(unsigned char *instr,int inlen,unsigned char *outstr)rnrn int i;rn unsigned char c,high,low;rn for(i=0;i='0'&&c='A'&&c='a'&&c='0'&&c='A'&&c='a'&&c<<4)+low;rn rn return inlen/2;rn
java 代码翻译C#代码
求高手帮用C#重写以下<em>代码</em>。rnpublic DesEncrypter()rn this("keyxyz");rn rn //加密rn public String encrypt(String str) rn try rn // Encode the string into bytes using utf-8rn byte[] utf8 = str.getBytes("UTF8");rnrn // Encryptrn byte[] enc = ecipher.doFinal(utf8);rnrn // Encode bytes to base64 to get a stringrn return new sun.misc.BASE64Encoder().encode(enc);rn rn catch (javax.crypto.BadPaddingException e) rn rn catch (IllegalBlockSizeException e) rn rn catch (UnsupportedEncodingException e) rn rn catch (java.io.IOException e) rn rn return null;rn rn//解密rn public String decrypt(String str) rn try rn // Decode base64 to get bytesrn byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);rnrn // Decryptrn byte[] utf8 = dcipher.doFinal(dec);rnrn // Decode using utf-8rn return new String(utf8, "UTF8");rn rn catch (javax.crypto.BadPaddingException e) rn rn catch (IllegalBlockSizeException e) rn rn catch (UnsupportedEncodingException e) rn rn catch (java.io.IOException e) rn rn return null;rn
帮忙翻译算法。。 DELPHI翻译C的
这是原来的<em>代码</em>。rn[code=Delphi(Pascal)]procedure TForm1.Button1Click(Sender: TObject); rnvar rn T:Int64; rn D:TDateTime; rnbegin rn T:=1167627540218; rn// T:=1167640359140; rn D:=UnixToDateTime(T div 1000); rn D:=D+8/24; //时间戳是格林威治时间,转换到中国+8区 rn ShowMessage(DateTimeToStr(D)); rnend; [/code]rnrnrnrn我朋友<em><em>翻译</em>成</em>C的了rn[code=C/C++]string UnixToDateTime(INT64 iMinSecond)rnrn int iSecond = iMinSecond/1000;rn int iYear = iSecond/(365*24*3600);rn iSecond -=iYear*(365*24*3600);rn int iMonth = iSecond/(30*24*3600);rn iSecond -=iMonth*(30*24*3600);rn int iDay = iSecond/(24*3600);rn iSecond -=iDay*(24*3600);rn int iHour = iSecond/3600;rn iSecond -=iHour*(3600);rn int iMin = iSecond/60;rn iSecond -=iMin*(60);rnrn char sDay[64] =0;rn sprintf(sDay,"%04d/%02d/%02d %02d:%02d:%02d",iYear+1970,iMonth+1,iDay+1,iHour,iMin,iSecond);rn return sDay;rn [/code]rnrn但是最后的结果不一样哦。rn有没有兄弟可以帮忙检查下。rnrn
求高人翻译一段代码翻译c#,献上100分
var hexcase = 1;rnvar b64pad = "";rnvar chrsz = 8;rnvar mode = 32;rnrnfunction preprocess(form)rnrn var str = "";rn str += form.verifycode.value;rn str = str.toUpperCase();rn form.p.value = md5(md5_3(form.p.value)+str);rn return true;rnrnrnfunction md5_3(s)rnrn var tmp = new Array;rn tmp = core_md5(str2binl(s), s.length * chrsz);rn tmp = core_md5(tmp, 16 * chrsz);rn tmp = core_md5(tmp, 16 * chrsz);rn return binl2hex(tmp);rnrnrnfunction md5(s)rnrn return hex_md5(s);rnrnfunction hex_md5(s)rnrn return binl2hex(core_md5(str2binl(s), s.length * chrsz));rnrnrnfunction b64_md5(s)rnrn return binl2b64(core_md5(str2binl(s), s.length * chrsz));rnrnrnfunction str_md5(s)rnrn return binl2str(core_md5(str2binl(s), s.length * chrsz));rnrnrnfunction hex_hmac_md5(key, data)rnrn return binl2hex(core_hmac_md5(key, data));rnrnrnfunction b64_hmac_md5(key, data)rnrn return binl2b64(core_hmac_md5(key, data));rnrnrnfunction str_hmac_md5(key, data)rnrn return binl2str(core_hmac_md5(key, data));rnrnrnfunction md5_vm_test()rnrn return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";rnrnrnfunction core_md5(x, len)rnrn x[len >> 5] |= 0x80 << ((len) % 32);rn x[(((len + 64) >>> 9) << 4) + 14] = len;rnrn var a = 1732584193;rn var b = - 271733879;rn var c = - 1732584194;rn var d = 271733878;rnrn for (var i = 0; i < x.length; i += 16)rn rn var olda = a;rn var oldb = b;rn var oldc = c;rn var oldd = d;rnrn a = md5_ff(a, b, c, d, x[i + 0], 7, - 680876936);rn d = md5_ff(d, a, b, c, x[i + 1], 12, - 389564586);rn c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);rn b = md5_ff(b, c, d, a, x[i + 3], 22, - 1044525330);rn a = md5_ff(a, b, c, d, x[i + 4], 7, - 176418897);rn d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);rn c = md5_ff(c, d, a, b, x[i + 6], 17, - 1473231341);rn b = md5_ff(b, c, d, a, x[i + 7], 22, - 45705983);rn a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);rn d = md5_ff(d, a, b, c, x[i + 9], 12, - 1958414417);rn c = md5_ff(c, d, a, b, x[i + 10], 17, - 42063);rn b = md5_ff(b, c, d, a, x[i + 11], 22, - 1990404162);rn a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);rn d = md5_ff(d, a, b, c, x[i + 13], 12, - 40341101);rn c = md5_ff(c, d, a, b, x[i + 14], 17, - 1502002290);rn b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);rnrn a = md5_gg(a, b, c, d, x[i + 1], 5, - 165796510);rn d = md5_gg(d, a, b, c, x[i + 6], 9, - 1069501632);rn c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);rn b = md5_gg(b, c, d, a, x[i + 0], 20, - 373897302);rn a = md5_gg(a, b, c, d, x[i + 5], 5, - 701558691);rn d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);rn c = md5_gg(c, d, a, b, x[i + 15], 14, - 660478335);rn b = md5_gg(b, c, d, a, x[i + 4], 20, - 405537848);rn a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);rn d = md5_gg(d, a, b, c, x[i + 14], 9, - 1019803690);rn c = md5_gg(c, d, a, b, x[i + 3], 14, - 187363961);rn b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);rn a = md5_gg(a, b, c, d, x[i + 13], 5, - 1444681467);rn d = md5_gg(d, a, b, c, x[i + 2], 9, - 51403784);rn c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);rn b = md5_gg(b, c, d, a, x[i + 12], 20, - 1926607734);rnrn a = md5_hh(a, b, c, d, x[i + 5], 4, - 378558);rn d = md5_hh(d, a, b, c, x[i + 8], 11, - 2022574463);rn c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);rn b = md5_hh(b, c, d, a, x[i + 14], 23, - 35309556);rn a = md5_hh(a, b, c, d, x[i + 1], 4, - 1530992060);rn d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);rn c = md5_hh(c, d, a, b, x[i + 7], 16, - 155497632);rn b = md5_hh(b, c, d, a, x[i + 10], 23, - 1094730640);rn a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);rn d = md5_hh(d, a, b, c, x[i + 0], 11, - 358537222);rn c = md5_hh(c, d, a, b, x[i + 3], 16, - 722521979);rn b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);rn a = md5_hh(a, b, c, d, x[i + 9], 4, - 640364487);rn d = md5_hh(d, a, b, c, x[i + 12], 11, - 421815835);rn c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);rn b = md5_hh(b, c, d, a, x[i + 2], 23, - 995338651);rnrn a = md5_ii(a, b, c, d, x[i + 0], 6, - 198630844);rn d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);rn c = md5_ii(c, d, a, b, x[i + 14], 15, - 1416354905);rn b = md5_ii(b, c, d, a, x[i + 5], 21, - 57434055);rn a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);rn d = md5_ii(d, a, b, c, x[i + 3], 10, - 1894986606);rn c = md5_ii(c, d, a, b, x[i + 10], 15, - 1051523);rn b = md5_ii(b, c, d, a, x[i + 1], 21, - 2054922799);rn a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);rn d = md5_ii(d, a, b, c, x[i + 15], 10, - 30611744);rn c = md5_ii(c, d, a, b, x[i + 6], 15, - 1560198380);rn b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);rn a = md5_ii(a, b, c, d, x[i + 4], 6, - 145523070);rn d = md5_ii(d, a, b, c, x[i + 11], 10, - 1120210379);rn c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);rn b = md5_ii(b, c, d, a, x[i + 9], 21, - 343485551);rnrn a = safe_add(a, olda);rn b = safe_add(b, oldb);rn c = safe_add(c, oldc);rn d = safe_add(d, oldd);rn rn if (mode == 16)rn rn return Array(b, c);rn rn elsern rn return Array(a, b, c, d);rn rnrnrnfunction md5_cmn(q, a, b, x, s, t)rnrn return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);rnrnrnfunction md5_ff(a, b, c, d, x, s, t)rnrn return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);rnrnrnfunction md5_gg(a, b, c, d, x, s, t)rnrn return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);rnrnrnfunction md5_hh(a, b, c, d, x, s, t)rnrn return md5_cmn(b ^ c ^ d, a, b, x, s, t);rnrnrnfunction md5_ii(a, b, c, d, x, s, t)rnrn return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);rnrnrnfunction core_hmac_md5(key, data)rnrn var bkey = str2binl(key);rn if (bkey.length > 16)rn bkey = core_md5(bkey, key.length * chrsz);rnrn var ipad = Array(16), opad = Array(16);rn for (var i = 0; i < 16; i++)rn rn ipad[i] = bkey[i] ^ 0x36363636;rn opad[i] = bkey[i] ^ 0x5C5C5C5C;rn rnrn var hash = core_md5(ipad.concat(str2binl(data)), 512+data.length * chrsz);rn return core_md5(opad.concat(hash), 512+128);rnrnrnfunction safe_add(x, y)rnrn var lsw = (x & 0xFFFF) + (y & 0xFFFF);rn var msw = (x >> 16) + (y >> 16) + (lsw >> 16);rn return (msw << 16) | (lsw & 0xFFFF);rnrnrnfunction bit_rol(num, cnt)rnrn return (num << cnt) | (num >>> (32-cnt));rnrnrnfunction str2binl(str)rnrn var bin = Array();rn var mask = (1 << chrsz) - 1;rn for (var i = 0; i < str.length * chrsz; i += chrsz)rn bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (i % 32);rn return bin;rnrnrnfunction binl2str(bin)rnrn var str = "";rn var mask = (1 << chrsz) - 1;rn for (var i = 0; i < bin.length * 32; i += chrsz)rn str += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask);rn return str;rnrnrnfunction binl2hex(binarray)rnrn var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";rn var str = "";rnrn for (var i = 0; i < binarray.length * 4; i++)rn rn str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8+4)) & 0xF) +rn hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);rn rn return str;rnrnrnfunction binl2b64(binarray)rnrn var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";rn var str = "";rn for (var i = 0; i < binarray.length * 4; i += 3)rn rn var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) | ((rn (binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) | ((binarray[irn + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);rn for (var j = 0; j < 4; j++)rn rn if (i * 8+j * 6 > binarray.length * 32)rn str += b64pad;rn elsern str += tab.charAt((triplet >> 6 * (3-j)) & 0x3F);rn rn rn return str;rn
c语言错误翻译(英语翻译汉语)
整理了一些c语言中的错误<em>翻译</em>,供给大家参考学习
这句代码翻译VB.net应该怎么翻译
public ScoreSetting this[int index]rnrn rnrn get rnrn rnrn if ( members != null )rnrn return (ScoreSetting)( members[index] );rnrn elsernrn return null;rnrn rnrn rnrnrn怎么想都想不明白这种语法在VB里应该怎么样?rn
求大神帮忙翻译一下VB代码~翻译C#的
Private Sub input_Click()rnrnrnCommonDialog1.Filter = "all files(*.*)|*.*|text_files(*.txt)|*.txt|batch files(*.bat)|*.bat"rnCommonDialog1.ShowOpenrnrnOpen CommonDialog1.FileName For Input As #1rn Input #1, mrn rn For i = 1 To mrn Input #1, noriver(i)rn Next irn rn For i = 1 To mrn Input #1, ff(i)rn Next irn rnrn rn num = 1rn Do While Not EOF(1) '==============资料输入rn Input #1, t(num)rn rn rn pp(num) = 0rn For i = 1 To mrn Input #1, p(num, i)rn pp(num) = p(num, i) * ff(i) + pp(num)rn Next irn rn rn Input #1, EPpP(num)rn rn num = num + 1rn Looprn rn num = num - 1 '这里表示原始系列的个数rnrn n = numrnClose #1rnrnrnOpen App.Path & "\源口站水位流量关系.txt" For Input As #2rnrn For i = 1 To 107rn Input #2, h(i), qh(i)rn Next irnrnClose #2rnrnrnrnEnd Sub
《PHP 设计模式》翻译完毕
<em>翻译</em>进度请见:https://laravel-china.org/doc... 设计模式不仅代表着更快开发健壮软件的有用方法,而且还提供了以友好的术语封装大型理念的方法。例如,您可以说您正在编写一个提供松散耦合的消息传递系统,也可以说你正在编写名称为观察者 的模式。 用较小的示例展示模式的价值是非常困难的。这往往有些大材小用的意味,因为...
C/C++头文件翻译C#
我需要把C/C++的一个头文件<em><em>翻译</em>成</em>C#的,看起来文件不难,就是不知道方法,怎么<em>翻译</em>过来。请大神帮忙看下,对你们来说应该不难[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/21.gif][/img]。rnrn下面rnrn#pragma oncernrn#ifdef HWNETMAPVAR_EXPORTSrn #define HWNETMAPVAR_API __declspec(dllexport)rn#elsern #define HWNETMAPVAR_API __declspec(dllimport)rn#endifrnrn#define ERR_PARAMETER_INVALID -100 //参数错误rn#define ERR_VARSIZE_INCORRECT -99 //变量大小错误 rn#define ERR_VARNAME_INVALID -98 //变量名错误rn#define ERR_NO_NEWDATA -97 //数据是已经被读取过的老数据rn#define ERR_TYPE_NOMATCH -96 //类型不一致rn#define ERR_MACHINENAME_INVALID -95 //无效机器名rnrn//变量类型定义rn#define TYPE_NONE 0rn#define TYPE_DOUBLE 1rnrn//变量操作类型rn#define VAR_READ 0rn#define VAR_WRITE 1rn//发布订阅rn#define SUBSCRIBE_DO 0rn#define SUBSCRIBE_CANCEL 1rnrntypedef bool (__cdecl* __Initialize )(const char* pcsLocalSectionName);rntypedef void (__cdecl* __UnInitialize )();rntypedef int (__cdecl* __VarAction )(int nAction,const char* pcsSectionName,const char* pcsVarName,int nVarType,void* pData,int nCount);rn
几行C代码翻译java
[code=C/C++][/code]rnunsigned char crc8fun(unsigned char in,unsigned char preset)rnrn int loop;rn unsigned char out;rn const unsigned char crc_pol=0xb8;rn out=in^presetrn for(loop=0;0>1)^crc_pol;rn rn elsern rn out=(out>>1);rn rn rnreturn out;rn
请问这段C代码如何翻译Java?一定给分
main()rnrn int a[10];rn int i;rn printf("please input 10 number:");rn for(i=0;i,&a[i]);rnrn
求js翻译c#代码
[code=javascript]rn rn[/code]rnrn这句是js的<em>代码</em>,如何<em><em>翻译</em>成</em><em>c#</em>的呢?rn主要是for中间的 charat和charcodeatrn
求助:VB.Net代码翻译C#
拜托C#大神将以下VB.Net<em>代码</em><em><em>翻译</em>成</em>C#,不要用工具或软件,本人刚学C#,稍复杂的修改不会,那样根本用不了,多谢了!rn[code=vb]Public Function getAttr(ByVal obj As Object, ByVal attr_name As String) As Objectrnrn Dim attrs As Objectrn Dim attr As IAttributern attrs = obj.AttrsEx1(True, False)rn Dim i As Integerrn rn For i = 0 To UBound(attrs)rn attr = attrs(i)rn If attr.Name = attr_name Thenrn Return attr rn End Ifrn Nextrn Return NothingrnEnd FunctionrnrnPublic Function getAttrValue(ByVal attr_point As IAttribute, ByVal type_str As String, Optional ByVal unit_str As Integer = 11) As Stringrn getAttrValue = ""rn If type_str = "Int" Thenrn getAttrValue = Str(attr_point.IntVal)rn ElseIf type_str = "String" Thenrn getAttrValue = attr_point.StrValrn ElseIf type_str = "Length" Thenrn getAttrValue = Str(attr_point.Length(unit_str))rn ElseIf type_str = "Double" Thenrn getAttrValue = Str(attr_point.DoubleVal)rn ElseIf type_str = "AREA" Thenrn getAttrValue = Str(attr_point.Area(unit_str))rn ElseIf type_str = "ENUM" Thenrn getAttrValue = attr_point.StrValrn ElseIf type_str = "Boolean" Thenrn getAttrValue = attr_point.BoolValrn End Ifrn Return getAttrValue rnEnd FunctionrnrnrnFunction setAttribute(ByVal obj As Object, ByVal attr_name As String, ByVal attr_type As String, ByVal attr_value As String, Optional ByVal attr_unit As Integer = 11) As Booleanrn Dim attrMod As IAttributesModifierrn attrMod = AM.AttributesModifier(obj)rn If attr_type = "String" Thenrn Call attrMod.SetString(attr_name, attr_value)rn ElseIf attr_type = "ENUM" Thenrn Call attrMod.SetString(attr_name, attr_value)rn ElseIf attr_type = "Double" Thenrn Call attrMod.SetDouble(attr_name, attr_value)rn ElseIf attr_type = "Length" Thenrn Call attrMod.SetLength(attr_name, attr_value, attr_unit)rn ElseIf attr_type = "Int" Thenrn Call attrMod.SetInteger(attr_name, attr_value)rn ElseIf attr_type = "Area" Thenrn Call attrMod.SetArea(attr_name, attr_value, attr_unit)rn ElseIf attr_type = "Boolean" Thenrn Call attrMod.SetBoolean(attr_name, attr_value)rn End Ifrn attrMod.Run()rn If statusCheck(attrMod) = False Thenrn Return Falsern End Ifrn Return TruernEnd FunctionrnrnPublic Function statusCheck(ByVal obj As Object) As Booleanrn statusCheck = Truern If obj.ErrorStatus <> 0 Thenrn MsgBox(obj.ErrorMessage)rn Return Falsern End IfrnEnd Function[/code]
将下面的代码翻译C#
如题:rn[code=VBScript]function getvalue(qz,str)rn dim y,i,s,jrn y=right(year(trim(date())),2)rn for i=1 to len(str)rn s=mid(str,i,1)rn if cint(s)>0 thenrn j=irn exit forrn end ifrn nextrn if cint(j)>len(str) then j=len(str)rn i=cint(right(str,len(str)+1-j))+1rn i=right("0000"&cstr(i),4)rn getpzh=qz&y&irnend function[/code]
几句Java翻译C#代码
Java的BigInteger 类库和C#有点不一样,不知道要如何使用,有谁知道下面的<em>代码</em>要如何用C#写出来吗?rn[code=java]rn//下面这些是Java的<em>代码</em>rnString hex = "37623432623933353435663935386463"rnString modulus = "00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7";rnString pubKey = "010001";rnrnBigInteger bigInteger1 = new BigInteger(hex, 16);rnBigInteger bigInteger2 = new BigInteger(pubKey, 16);rnBigInteger bigInteger3 = new BigInteger(modulus, 16);rn// RSA加密计算rnBigInteger bigInteger4 = bigInteger1.pow(bigInteger2.intValue()).remainder(bigInteger3);rnString encSecKey = Hex.encodeHexStr(bigInteger4.toByteArray());rn[/code]
c#代码翻译vb.net
下面的<em>代码</em>在asp.net 2.0中:rn rn请帮忙把<em>代码</em><em><em>翻译</em>成</em>vb.net。
一段代码翻译C#
private byte[] getRamFormatValue(double mValue) rn byte[] mTemp = new byte[8];rn String mStr = Double.toHexString(mValue);rn long mRamE = Integer.parseInt("" + mStr.charAt(mStr.length() - 1), 16);rn mRamE = mRamE + 1023;rn mTemp[7] = (byte) ((mRamE >> 4) & 0xFF);rn mTemp[6] = (byte) (mRamE & 0x0F);rn String mSub = mStr.substring(mStr.indexOf(".") + 1, mStr.indexOf("p"));rn if (mSub.length() < 13) rn for (int i = mSub.length(); i < 13; i++) rn mSub = mSub + "0";rn rn rn mRamE = Integer.parseInt(mSub.substring(0, 1), 16);rn mTemp[6] = (byte) ((mTemp[6] << 4) | (mRamE & 0xFF));rn mSub = mSub.substring(1);rn for (int i = 0; i < 6; i++) rn int mTempFirst = Integer.parseInt(mSub.substring(2 * i, 2 * i + 1), 16);rn int mTempLast = Integer.parseInt(mSub.substring(2 * i + 1, 2 * i + 2), 16);rn mTemp[5 - i] = (byte) (mTempFirst << 4 | mTempLast);rn rnrn return mTemp;rn
麻烦帮我把这段VBscript翻译C#的代码。(马上给分
Imports System.Web.SecurityrnSub btnname_click(ByVal s As Object, ByVal e As EventArgs)rnlbname.Text = EncryptPassword(txtname.Text, "md5")rnResponse.Write("br" & EncryptPassword(txtname.Text, "sha1"))rnEnd SubrnrnFunction EncryptPassword(ByVal password As String, ByVal passwordformate As String)rnIf passwordformate = "sha1" ThenrnEncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "sha1")rnElseIf passwordformate = "md5" ThenrnEncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "md5")rnElsernEncryptPassword = ""rnEnd IfrnEnd Functionrn
把一句C代码翻译C++代码
[code=C/C++]rnprintf("%d", i);rn[/code]rn就这句<em>代码</em>,各位来<em>翻译</em><em>翻译</em>。哥将以最严格的标准来检查答案[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/14.gif][/img]rn话都说在这份上。你们懂的
把C++代码翻译C代码?
能否用C语言开发一个东东,rn把C++<em>代码</em><em><em>翻译</em>成</em>C<em>代码</em>?rn想法可行否?
将此段代码翻译C# 代码
这是一段java<em>代码</em>,MD5加密,但小弟不懂java,希望各位提点一二,将此<em>代码</em>用C#写出来,小弟感激不尽。rn rnrnrnpublic static String getKeyedDigest(String strSrc, String key) rn try rn MessageDigest md5 = MessageDigest.getInstance("MD5");rn md5.update(strSrc.getBytes("UTF8"));rnrn String result="";rn byte[] temp;rn temp=md5.digest(key.getBytes("UTF8"));rn for (int i=0; i
几行C#代码翻译VB6代码
C#<em>代码</em>如下:rn.................................rn FileStream fs = File.Open("C:\ccc.doc", FileMode.Open, FileAccess.Read);rn byte[] array = new byte[fs.Length];rn fs.Read(array, 0, (int)fs.Length);rn fs.Close();rn...................................rn由于开发需要,现在想把这几行<em>代码</em>用VB6来实现,那应该怎么写?麻烦那位大虾出手帮帮忙,感激不尽!
将C#代码翻译VB代码
private void panelClear(string mess) rn rn if (mainPanel.Controls.Count > 0) rn rn mainPanel.Controls.Clear(); rn rn rnrnrn private void btnBout_Click(object sender, EventArgs e) rn rn NewProtagonistForm newProtagonistForm = new NewProtagonistForm(); rn this.panelClear("字符串"); rn mainPanel.Controls.Add(newProtagonistForm); rn
Script代码翻译C#语言代码
# ASCIIToRaster_sample.pyrn# Description: rn# Converts an ASCII file representing raster data to a raster.rn# Requirements: Nonern# Author: ESRIrn# Date: Oct 20, 2005rn# Import system modulesrnimport arcgisscriptingrnrn# Create the Geoprocessor objectrngp = arcgisscripting.create()rnrntry:rn # Set local variablesrn InAsciiFile = "C:/data/raster2ascii.asc"rn OutRaster = "C:/data/raster1"rnrn # Process: ASCIIToRaster_conversionrn gp.ASCIIToRaster_conversion(InAsciiFile, OutRaster, "INTEGER")rnrnexcept:rn # Print error message if an error occursrn print gp.GetMessages()rn应该是接口的调用.ArcGIS里工具的调用.
~~~~~~~~急求助: Delphi的代码翻译C#代码 ~~~~~~~~~~
要<em>翻译</em>的<em>代码</em>为:rn//解密函数rnFunction UncrypKey(Src:String; Key:String):string;rnvarrn idx :integer;rn KeyLen :Integer;rn KeyPos :Integer;rn offset :Integer;rn dest :string;rn SrcPos :Integer;rn SrcAsc :Integer;rn TmpSrcAsc :Integer;rn Range :Integer;rnbeginrn KeyLen:=Length(Key);rn if KeyLen = 0 thenrn key:='Think Space';rn KeyPos:=0;rn SrcPos:=0;rn SrcAsc:=0;rn Range:=256;rn offset:=StrToInt('$'+ copy(src,1,2));rn SrcPos:=3;rn repeatrn SrcAsc:=StrToInt('$'+ copy(src,SrcPos,2));rn if KeyPos < KeyLen Thenrn KeyPos := KeyPos + 1rn elsern KeyPos := 1;rn TmpSrcAsc := SrcAsc xor Ord(Key[KeyPos]);rn if TmpSrcAsc = Length(Src);rn Result:=Dest;rnend;
C++代码如何翻译C#代码???
谁能帮我把下面的C++<em>代码</em>如何<em><em>翻译</em>成</em>C#<em>代码</em>,<em>代码</em>功能是读出指定硬件的VID ,PID,下面是VC实现的<em>代码</em>,C#我不熟悉rnrn<em>代码</em>谁能给我<em>翻译</em>一下rn#include rn#include rn#include rn#include rn#include rnrnint main( int argc, char *argv[ ], char *envp[ ] )rnrn HDEVINFO hDevInfo;rn GUID guid = 0x50DD5230,0xBA8A,0x11D1,0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30;//枚举当前USB设备 rn SP_DEVINFO_DATA DeviceInfoData;rn DWORD i;rn rn // Create a HDEVINFO with all present devices.rn hDevInfo = SetupDiGetClassDevs( &guid,rn 0, // Enumeratorrn 0,rn DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);rn rn if (hDevInfo == INVALID_HANDLE_VALUE)rn rn // Insert error handling here.rn return 1;rn rn rn // Enumerate through all devices in Set.rn rn DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);rn for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,rn &DeviceInfoData);i++)rn rn DWORD DataT;rn LPTSTR buffer = NULL;rn DWORD buffersize = 0;rn rn // rn // Call function with null to begin with, rn // then use the returned buffer size rn // to Alloc the buffer. Keep calling untilrn // success or an unknown failure.rn // rn while (!SetupDiGetDeviceRegistryProperty(rn hDevInfo,rn &DeviceInfoData,rn SPDRP_HARDWAREID,rn &DataT,rn (PBYTE)buffer,rn buffersize,rn &buffersize))rn rn if (GetLastError() == rn ERROR_INSUFFICIENT_BUFFER)rn rn // Change the buffer size.rn if (buffer) LocalFree(buffer);rn buffer = (LPTSTR)LocalAlloc(LPTR,buffersize);rn rn elsern rn // Insert error handling here.rn break;rn rn rn rn printf("Result:[%s]\n",buffer);rn rn if (buffer) LocalFree(buffer);rn rn rn rn if ( GetLastError()!=NO_ERROR &&rn GetLastError()!=ERROR_NO_MORE_ITEMS )rn rn // Insert error handling here.rn return 1;rn rn rn // Cleanuprn SetupDiDestroyDeviceInfoList(hDevInfo);rn rn return 0;rn
将delphi代码翻译c#代码
在线等,就两个简单方法,<em>代码</em>不便公开,大家谁会帮个忙吧,q我 540011858,在线等。谢谢大家了
C#代码帮忙翻译Delphi7代码
[code=C#]rnIntPtr p = BASS_ChannelGetTags(stream, BASS_TAG_ID3);rnrn// check, if ID3v1rnstring id = Marshal.PtrToStringAnsi(p, 3);rnif (id != "TAG")rn return false;rnrn// song title (comes after 'TAG')...rnp = new IntPtr((byte*)p.ToPointer() + 3);rnstring title = Marshal.PtrToStringAnsi(p).TrimEnd('\0');rnint idx = title.IndexOf('\0');rnif (idx > 0)rn title = title.Substring(0, idx);rn// artist...rnp = new IntPtr((byte*)p.ToPointer() + 30);rnstring artist = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');rnidx = artist.IndexOf('\0');rnif (idx > 0)rn artist = artist.Substring(0, idx);rn// album...rnp = new IntPtr((byte*)p.ToPointer() + 30);rnstring album = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');rnidx = album.IndexOf('\0');rnif (idx > 0)rn album = album.Substring(0, idx);rn// year...rnp = new IntPtr((byte*)p.ToPointer() + 30);rnstring year = Marshal.PtrToStringAnsi(p, 4).TrimEnd('\0');rnidx = year.IndexOf('\0');rnif (idx > 0)rn year = year.Substring(0, idx);rn// comment...rnp = new IntPtr((byte*)p.ToPointer() + 4);rnstring comment = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');rnidx = comment.IndexOf('\0');rnif (idx > 0)rn comment = comment.Substring(0, idx);rn// genre-id...rnp = new IntPtr((byte*)p.ToPointer() + 30);rnint genreId = (int)Marshal.ReadByte(p);rn[/code]
VB.Net代码翻译注释。最好翻译asp.net代码
Private Function StringToUTF8(ByVal strIn As String) As Stringrn Dim x As Integerrn Dim sW As Stringrn strIn = Replace(strIn, vbCrLf, vbCr)rn StringToUTF8 = ""rn Dim il = Len(strIn)rn For x = 1 To ilrn sW = CStr(Hex(AscW(Mid(strIn, x))))rn If Len(sW) < 2 Thenrn sW = "000" & sWrn ElseIf Len(sW) < 4 Thenrn sW = "00" & sWrn End Ifrn StringToUTF8 = StringToUTF8 & sWrn Next xrn End Functionrn拜托。。。。。
《 Redis命令参考》全文翻译完毕
很高兴地告诉各位,对《Redis Command Reference》一文的<em>翻译</em>已经全部完成。在七月份放出前六章的<em>翻译</em>迄今为止已经过去了近半年,前两天本人终于抽出时间(和决心)来完成剩下的四章,现在全文共十个部分的所有命令都已经<em>翻译</em><em>完毕</em>了。并且,对比 Redis 官方文档,译文还有以下改进:- 修改了官方文档一些拗口的地方,统一了文风(官方文档是多人协作),对于一些不好的例子进行了结构重排甚至重写...
VB改C# 直接翻译 不要留废话 只要翻译完 立马给分,在线等待!!
For i = 1 To 128rn bitinfo = tempzw(i)rn bitmap = &H80rn For k = 1 To 8rn getbit = bitinfo And bitmaprn If getbit = 0 Thenrn Picture1.FillColor = &H0rn Elsern Picture1.FillColor = &HF0rn End Ifrn Picture1.Circle ((i - 1) * 6 + 2, (k - 1) * 6 + 2), 3, &H80rn bitmap = bitmap / 2rn Next krnNext irnrnFor i = 1 To 128rn bitinfo = tempzw(i + 128)rn bitmap = &H80rn For k = 1 To 8rn getbit = bitinfo And bitmaprn If getbit = 0 Thenrn Picture1.FillColor = &H0rn Elsern Picture1.FillColor = &HF0rn End Ifrn Picture1.Circle ((i - 1) * 6 + 2, (k - 1) * 6 + 2 + 8 * 6), 3, &H80rn bitmap = bitmap / 2rn Next krnNext irn其中bitinfo、 bitmap 、getbit是byte类型 ,tempzw是一个256的数组,&H80是十六进制
翻译一段VB代码到C
这是一段VB6的<em>代码</em>,谁能给<em><em>翻译</em>成</em>C语言的rnPublic tempdata() As LongrnPublic NumBase(5) As Long '基数rnPublic NumUnit(4) As Long '每单位对应的16进制数rnPublic NumUnitPrice(4) As Long '每单位对于的10进制数,已被从元为单位扩大1000倍rnPublic Type tempFSTrecord '每一条记录的长度为26字节:rn FSTtime As Integerrn price As Longrn avgPrice As Longrn changor As Integerrn unUse0 As Integerrn unUse1 As Longrn unUse2 As Longrn unUse3 As LongrnEnd TypernFunction LoadFSTdata(ByVal filename As String, fst() As FSTrecord) '240个分记录,26个字节一个记录,6508字节一天rn Dim ifile As Integer, i As Integer, j As Integerrn Dim TFR As tempFSTrecordrn Dim fileP As Longrn Dim lenDayFST As Long: longDayFST = 6508rn Dim lenminuteFST As Long: lenminuteFST = 26rn ifile = FreeFilern Open filename For Binary As ifilern 'LoadFSTdata = (LOF(ifile) - 8) / 26 - 10rn LoadFSTdata = LOF(ifile) / 6508rnrn ReDim fst(1 To LoadFSTdata, 239)rn ReDim tempdata(1 To LoadFSTdata)rn ReDim tempMidprice(1 To LoadFSTdata)rn ReDim fstMaxPrice(1 To LoadFSTdata)rn For j = 1 To LoadFSTdatarn Get ifile, 1 + (j - 1) * longDayFST, tempdata(j)rn Get ifile, 5 + (j - 1) * longDayFST, tempMidprice(j)rn fstMaxPrice(j) = 0rn For i = 0 To 239rn fileP = (j - 1) * longDayFST + i * lenminuteFST + 8 + 1rn Get ifile, fileP, TFRrn fst(j, i).FSTtime = TFR.FSTtime + 1 'fst(i).FSTtime = TimeSerial(0, TFR.FSTtime + 1, 0)rn fst(j, i).price = TFR.pricern fst(j, i).avgPrice = TFR.avgPricern fst(j, i).changor = TFR.changorrn If Abs(TFR.price - tempMidprice(j)) > fstMaxPrice(j) Thenrn fstMaxPrice(j) = Abs(TFR.price - tempMidprice(j))rn End Ifrn Next irn Next jrn Close ifilernEnd FunctionFunction getRealPrice(formerPrice As Long) As Long '注意移植此函数是要把公共变量NumBase预NumUnit移动移植rn Dim i As Integerrn For i = 1 To 4 '该函数可返回32元人民币以下对于的准确价格rn If formerPrice < NumBase(i) Thenrn getRealPrice = (Val((formerPrice - NumBase(i - 1)) & "000") / NumUnit(i - 1)) + NumUnitPrice(i - 1)rn Exit For ' & 000 相当于 * 1000,以‰为单位rn End Ifrn Next irnEnd FunctionrnPublic Sub main()rn NumBase(0) = 1065353216: NumBase(1) = 1082130432: NumBase(2) = 1090519040: NumBase(3) = 1098907648: NumBase(4) = 1109655552 ': NumBase(5) = 1118830592rn NumUnit(0) = 4194304: NumUnit(1) = 2097152: NumUnit(2) = 1048576: NumUnit(3) = 524288 ': NumUnit(4) = 262144rn NumUnitPrice(0) = 0: NumUnitPrice(1) = 4000: NumUnitPrice(2) = 8000: NumUnitPrice(3) = 16000 ': NumUnitPrice(4) = 32000rn readZST.Show'由这个窗体去调用以上的函数,自己写rnEnd Sub
怎样翻译这段C代码
调用Dll文件中的一个函数rn int ret;rn char * host_list[3] = "192.168.0.2", "192.168.0.3", "";rnrn // 初始化布控函数库rn ret = READCD(host_list);rnrn其中READCD是DLL文件定义的函数,声明如下rnint READCD(char ** host_list);rnrn谢谢!
很短的代码翻译C
76E336EE MOVS R2, #0x25rn76E336F0 LDRB R3, [R6,R5]rn76E336F2 LSLS R0, R5, #1rn76E336F4 ADDS R0, R1, R0rn76E336F6 LDR R1, =(a02x - 0x76E33702)rn76E336F8 EORS R2, R3rn76E336FA LSLS R2, R2, #0x18rn76E336FC ASRS R2, R2, #0x18
DNA翻译C语言代码
输入DNA序列,程序将把DNA序列<em><em>翻译</em>成</em>对应的mRNA序列,把DNA序列<em><em>翻译</em>成</em>对应的蛋白质序列
翻译简单的Dephi代码到C
arrRec: array of Byte;rnarrRec[i] := Byte (StrToInt ('$' + Chr (arrRec[i])));rnIf (arrRec[i] And 8) = 8 Thenrn Beginrn End;rn rnrn我的<em>翻译</em>:rnunsigned char arrRec[] = ... ;rnarrRec[i] = // ?rnif (arrRec[i] & 8 == 8)rnrnrnrn请帮忙。
c/c++代码翻译.
[code=c]rnu16 clac_sum(void *data,u32 len)rnrn if(len)rn rn u32 cksum=0;rn cksum += *(u8 *)p;rn __packed u16 *p = data;rn rn while(len>1)rn rn cksum = (cksum >>16) + (cksum & 0xffff);rn cksum += *p++;rn cksum +=(cksum>>16);rn len-=2;rn return ~cksum;rn rnrn[/code]rnrn上面是我手动打了. 为了方便大家帮修改..下面是原始文件rnrn妹的 上传不给力....rnrn就酱紫吧.. <em>翻译</em><em>c#</em>的 rnrn
翻译代码 java 转 c#
[code=java] public boolean doCheck(String content, String sign, String publicKey) throws Exception rn KeyFactory keyFactory = KeyFactory.getInstance("RSA");rn byte[] encodedKey = Base64.decodeBase64(publicKey);rn PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));rnrn java.security.Signature signature = java.security.Signature.getInstance("SHA1WithRSA");rnrn signature.initVerify(pubKey);rn signature.update(content.getBytes("UTF-8"));rn boolean bverify = signature.verify(Base64.decodeBase64(sign));rn return bverify;rn rn[/code]
将下面C语言代码翻译Java代码
#includern#includernrnconst long maxn=10;rnrnlong num[maxn];rnlong low[maxn];rnlong color[maxn];rnlong graph[maxn][maxn];rnbool cut[maxn];rnbool bridge[maxn][maxn];rnlong now;rnlong n;rnlong cutnum;rnlong bridgenum;rnlong father[maxn];rnlong child[maxn];rnrnvoid dfs(int);rnrnint main()rnrn int i, j;rn FILE *in=fopen( "input.txt", "r");rn FILE *out=fopen( "output.txt", "w");rn fscanf( in, "%d", &n);rn for ( i=1; i=2)||(father[i]!=0)&&(flag))rn rn cut[i]=true;rn cutnum++;rn rn
C#和vb.net代码相互转换,翻译
C#和vb.net<em>代码</em>相互转换 http://converter.telerik.com/
编写更好的C#代码
引言 开发人员总是喜欢就编码规范进行争论,但更重要的是如何能够在项目中自始至终地遵循编码规范,以保证项目<em>代码</em>的一致性。并且团队中的所有人都需要明确编码规范所起到的作用。在这篇文章中,我会介绍一些在我多年的从业过程中所学习和总结的一些较好的实践。 举例为先 我们先来看一个 FizzBuzz 示例。FizzBuzz 要求编写一个程序,遍历从 1 到 100 的数字。其中如果某数字是 3 的倍数,...
C语言翻译C#时出现的问题!
以下是最小二乘法曲线拟合的C<em>代码</em>,我想把它<em><em>翻译</em>成</em>C#语言,但是<em>翻译</em>过程中变量的域很乱,提示q变量未赋值,我主要搞不清楚C中的变量作用域与C#中的区别。以下是原<em>代码</em>和我<em>翻译</em>的<em>代码</em>,请大虾们指点?!rnrnC语言<em>代码</em>:rn #include "math.h"rn void hpir1(x,y,n,a,m,dt)rn //x,y数组,给定数据点的x,y坐标,rn //n,给定数据点的个数rn //a,数组,拟合多项式的m个系数rn //m,拟合多项式的项数,即拟合多项式的最高次数为m-1rn //dt,三项数组,dy(0)拟合多项式与数据点误差的平方和,dt(1)拟合多项式与数据点误差的绝对值之和,dt(2)拟合多项式与数据点误差绝对值的最大值rn int n,m;rn double x[],y[],a[],dt[];rn int i,j,k;rn double z,p,c,g,q,d1,d2,s[20],t[20],b[20];//z,p,c,g,q,d1,d2,s[20],t[20],b[20]rn for (i=0; in) m=n;rn if (m>20) m=20;rn z=0.0;rn for (i=0; i1)rn t[1]=1.0; t[0]=-p;rn d2=0.0; c=0.0; g=0.0;rn for (i=0; i=3)rn for (k=j-2; k>=1; k--)rn s[k]=-p*t[k]+t[k-1]-q*b[k];rn s[0]=-p*t[0]-q*b[0];rn d2=0.0; c=0.0; g=0.0;rn for (i=0; i=0; k--)rn q=q*(x[i]-z)+s[k];rn d2=d2+q*q; c=c+y[i]*q;rn g=g+(x[i]-z)*q*q;rn rn c=c/d2; p=g/d2; q=d2/d1;rn d1=d2;rn a[j]=c*s[j]; t[j]=s[j];rn for (k=j-1; k>=0; k--)rn a[k]=c*s[k]+a[k];rn b[k]=t[k]; t[k]=s[k];rn rn rn dt[0]=0.0; dt[1]=0.0; dt[2]=0.0;rn for (i=0; i=0; k--)rn q=a[k]+q*(x[i]-z);rn p=q-y[i];rn if (fabs(p)>dt[2]) dt[2]=fabs(p);rn dt[0]=dt[0]+p*p;rn dt[1]=dt[1]+fabs(p);rn rn return;rn rnrnrnC#语言<em>代码</em>:rn private void Linearity(double[] x, double[] y, int n, double[] a, int m, double[] dt)rn rn double z,p,c,g,q,d1,d2;rn double[] s=new double[20];rn double[] t=new double[20];rn double[] b=new double[20];rn for(int i=0; in)rn rn m=n;rn rn if(m>20)rn rn m=20;rn rn z=0.0;rn for(int i=0;i=1;k--)rn rn s[k]=-p*t[k]+t[k-1]-q*b[k];rn rn s[0]=-p*t[0]-q*b[0];rn d2=0.0;rn c=0.0;rn g=0.0;rn for (int i=0; i=0; k--)rn rn q=q*(x[i]-z)+s[k];rn rn d2=d2+q*q; c=c+y[i]*q;rn g=g+(x[i]-z)*q*q;rn rn c=c/d2; p=g/d2; q=d2/d1;rn d1=d2;rn a[j]=c*s[j]; t[j]=s[j];rn for (int k=j-1; k>=0; k--)rn rn a[k]=c*s[k]+a[k];rn b[k]=t[k]; t[k]=s[k];rn rn rn dt[0]=0.0; dt[1]=0.0; dt[2]=0.0;rn for (int i=0; i=0; k--)rn rn q=a[k]+q*(x[i]-z);rn rn p=q-y[i];rn if (Math.Abs(p)>dt[2]) rn rn dt[2]=Math.Abs(p);rn rn dt[0]=dt[0]+p*p;rn dt[1]=dt[1]+Math.Abs(p);rn rn return;rn rn rn
有一份C的代码翻译Delphi的
本人有一份VC的<em>代码</em>想<em><em>翻译</em>成</em>Delphi的,是一个DLL,有精通C和Delphi还有OD的大侠帮帮忙,辛苦费还是有的 呵呵。rn下在地址和具体在这里rnhttp://task.zhubajie.com/3537739/
汇编指令翻译C代码遇到困难,高手进
mov al,bhrn已经申请 DWORD eax, ebx;rn怎么把 ebx的高位给eax的低位呢?rn怎么样有效的简洁的实现 mov al,bhrn
帮忙把一小段代码翻译C#
[code=C/C++]#include rn#define MAX_VOLT 2.56rnvoid ValueToBinary(unsigned __int8 v,char *b) rn b[0]=v;rnrnvoid ConvertInitE(double initE, double finalE, char* buf) rn //initE=-1.3rn //MAX_VOLT=2.56rn //finalE=-1.9rn double volt = 0;rn unsigned __int16 ivolt;rnrn volt =initE * -1.0;rn ivolt = (unsigned __int16)((volt + MAX_VOLT) * 0xFFF / (MAX_VOLT * 2));rn unsigned __int8 m_iLow8 = ivolt & 0xFF;rn unsigned __int8 m_iHigh4 = (ivolt & 0xf00) >> 8;rn //转十六进制rn ValueToBinary(m_iHigh4, (char*)buf);rn ValueToBinary(m_iLow8, (char*)buf+1);rnrnint main() rn char s[2];rnrn ConvertInitE(-1.3,-1.9,s);rn printf("%02x %02x\n",(unsigned char)s[0],(unsigned char)s[1]);//0c 0frn return 0;rn[/code]
100分,把这段代码翻译c#
This function creates the Thumbnail image and returns thernimage created in Byte() formatrnPrivate Function createThumnail()Function createThumnail(ByVal ImageStream As Stream,rnByVal tWidth As Double, ByVal tHeight As Double) As Byte()rn Dim g As System.Drawing.Image =System.Drawing.Image.FromStream(ImageStream)rn Dim thumbSize As New Size()rn thumbSize =NewthumbSize(g.Width, g.Height, tWidth, tHeight)rn Dim imgOutput As New Bitmap(g, thumbSize.Width, thumbSize.Height)rn Dim imgStream As New MemoryStream()rn Dim thisFormat = g.RawFormatrn imgOutput.Save(imgStream, thisFormat)rn Dim imgbin(imgStream.Length) As Bytern imgStream.Position = 0rn Dim n As Int32 = imgStream.Read(imgbin, 0, imgbin.Length)rn g.Dispose()rn imgOutput.Dispose()rn Return imgbinrnEnd FunctionrnrnFunction NewthumbSize()Function NewthumbSize(ByVal currentwidth As Double, ByValrncurrentheight As Double, ByVal newWidth As Double, ByVal newHeight As Double)rn ' Calculate the Size of the New image rn Dim tempMultiplier As Doublernrn If currentheight > currentwidth Then ' portrait rn tempMultiplier = newHeight / currentheightrn Elsern tempMultiplier = newWidth / currentwidthrn End Ifrnrn Dim NewSize As New Size(CInt(currentwidth * tempMultiplier),rnCInt(currentheight * tempMultiplier)) rn Return NewSizernEnd Functionrn
请求将下列代码翻译c#的形式
字节流到图片可以参考以下方法(.NET vb):rnHttpContext.Current.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache) '不缓存rnHttpContext.Current.Response.ClearContent()rnHttpContext.Current.Response.ContentType = "image/Gif"rnHttpContext.Current.Response.BinaryWrite(Ary) 'Ary 图片字节数组rnHttpContext.Current.Response.End()rnrnrn这是VB.net的<em>代码</em>,哪位能<em><em>翻译</em>成</em><em>c#</em>的呢?谢谢
这句话翻译C#代码怎么写?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
帮我把C#翻译C++代码 StringToByteArray
帮我把C#<em><em>翻译</em>成</em>C++<em>代码</em> StringToByteArrayrn帮我<em>翻译</em>一下本段<em>代码</em>,把C#<em><em>翻译</em>成</em>C++,<em>代码</em>尽量简洁噢,而且要在VS2008中编译通过,分分给第一个实现功能完全一样滴同学.rn"2E00"转换结果是BYTE b[2] ; b[0]=46;b[1]=0;rn(46=0x2E)rn[code=C#]rnrn /// rn /// 完美游戏发包时将String包内容传进去,然后返回Byte[] 提供CALL方法调用rn /// rn /// 需要发包的明文字符串rn /// rn public static byte[] StringToByteArray(string str)rn rn List bytelist = new List();rn str = str.Replace(" ", "");//去空格rn int length = str.Length / 2;//包长度rnrn for (int i = 0; i < length; i++)rn rn bytelist.Add(Convert.ToByte(str.Substring(2 * i, 2), 16));rn rn return bytelist.ToArray();rn rn[/code]rn
谁能帮我把这段代码翻译c#
Private Sub Section12_Format(ByVal pFormattingInfo As Object)rn Select Case fldLastYearsSales.Valuern Case Is < 1000rn Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup20.bmp")rn Case 1001 To 2000rn Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup30.bmp")rn Case 2001 To 3000rn Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup40.bmp")rn Case Is > 3000rn Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup50.bmp")rn End SelectrnEnd Sub
翻译C#的代码,懂VB的人请进!!!
Public Function NumericPassword(ByVal password As String) As Longrn Dim Value As Longrn Dim ch As Longrn Dim shift1 As Longrn Dim shift2 As Longrn Dim I As Integerrn Dim str_len As Integerrn str_len = Len(password)rn For I = 1 To str_lenrn ch = Asc(Mid$(password, I, 1))rn Value = Value Xor (ch * 2 ^ shift1)rn Value = Value Xor (ch * 2 ^ shift2)rn shift1 = (shift1 + 7) Mod 19rn shift2 = (shift2 + 13) Mod 23rn Next Irn NumericPassword = ValuernEnd FunctionrnrnrnPublic Sub Cipher(ByVal password As String, ByVal from_text As String, ByRef to_text As String) 'password为密钥,from_text为原始文本,to_text为加密后文本rn Const MIN_ASC = 32 ' Space.rn Const MAX_ASC = 126 ' ~.rn Const NUM_ASC = MAX_ASC - MIN_ASC + 1rn Dim Offset As Longrn Dim str_len As Integerrn Dim I As Integerrn Dim ch As Integerrn Offset = NumericPassword(password)rn Rnd -1rn Randomize Offsetrn str_len = Len(from_text)rn For I = 1 To str_lenrn ch = Asc(Mid$(from_text, I, 1))rn If ch >= MIN_ASC And ch <= MAX_ASC Thenrn ch = ch - MIN_ASCrn Offset = Int((NUM_ASC + 1) * Rnd)rn ch = ((ch + Offset) Mod NUM_ASC)rn ch = ch + MIN_ASCrn to_text = to_text & Chr$(ch)rn End Ifrn Next IrnEnd Subrn
将这段java代码翻译C#代码
import java.security.MessageDigest;rnimport java.security.NoSuchAlgorithmException;rnrnpublic class KeyedDigestMD5 rn rn public static byte[] getKeyedDigest(byte[] buffer, byte[] key) rn try rn MessageDigest md5 = MessageDigest.getInstance("MD5");rn md5.update(buffer);rn return md5.digest(key);rn catch (NoSuchAlgorithmException e) rn rn return null;rn rn rn rn public static String getKeyedDigest(String strSrc, String key) rn try rn MessageDigest md5 = MessageDigest.getInstance("MD5");rn md5.update(strSrc.getBytes("UTF8"));rn rn String result="";rn byte[] temp;rn temp=md5.digest(key.getBytes("UTF8"));rn for (int i=0; i
谁能把VC的代码翻译C#
现在VS2005 C#的环境下调用一个VC做成的OCX,rn1、其中有个函数:vcrnlong CKeyOcx::ReadLockList(long sys_code, long password, long* lock_list)rnrn long result;rn static BYTE parms[] =rn VTS_I4 VTS_I4 VTS_PI4;rn InvokeHelper(0xb, DISPATCH_METHOD, VT_I4, (void*)&result, parms,rn sys_code, password, lock_list);rn return result;rnrn2、做成OCX,在C#中调用时的格式:rnint ReadLockList(int sys_code,int password, ref int lock_list); rn3、而在VC调用上面那个VC函数的利子为:rnvoid CKeyOcxTestDlg::OnReadLockList() rnrn // TODO: Add your control notification handler code herern rn UpdateData(TRUE);rn CString m_str;rn long list[3080];rn long length = m_keyocx.ReadLockList(m_edit1,m_edit2,list);rn if(length != 10000)rn rn m_edit27 = "";rn for(long i=0; i
高分100:求vc++翻译c#代码....
vc++<em>代码</em>:rnint xxxSystem::ansi2ucs(char *buf)rnrn int len = 0;rn WCHAR *buftemp = new WCHAR[MAX_MSG_LEN * 2]; //define MAX_MSG_LEN 200rn MultiByteToWideChar(0, 0, buf, -1, buftemp, MAX_MSG_LEN * 2);rn len = wcslen(buftemp);rn memset(buf, 0, len * 2);rn for(int i=0; i < len ; i++) //进行高8位与低8位互换rn rn buf[i * 2] = buftemp[i] >> 8;rn buf[i * 2 + 1] = buftemp[i]; rn rn buf[i * 2 + 2] = L'\0'; //加结束符rn len = len * 2;rn delete buftemp;rn buftemp = null;rn return len;rnrnrnrn现在要求转换为<em>c#</em><em>代码</em>,函数原型必须为:rnprivate string Ansic2Ucs(StringBuilder Msg_Content)rnrn //?????rnrnrn只要验证通过立即<em>给分</em>.....
求助 高手 把下面的代码翻译C#
// 解线性方程。data[count*(count+1)]矩阵数组;count:方程元数;rn// Answer[count]:求解数组 。返回:0求解成功,-1无解或者无穷解rnint LinearEquations(double *data, int count, double *Answer)rnrn int j, m, n;rn double tmp, **dat, *d = data;rn dat = (double**)malloc(count * sizeof(double*));rn for (m = 0; m < count; m ++, d += (count + 1))rn rn dat[m] = (double*)malloc((count + 1) * sizeof(double));rn memcpy(dat[m], d, (count + 1) * sizeof(double));rn rn d = (double*)malloc((count + 1) * sizeof(double));rn for (m = 0; m < count - 1; m ++)rn rn // 如果主对角线元素为0,行交换rn for (n = m + 1; n < count && dat[m][m] == 0.0; n ++)rn rn if ( dat[n][m] != 0.0)rn rn memcpy(d, dat[m], (count + 1) * sizeof(double));rn memcpy(dat[m], dat[n], (count + 1) * sizeof(double));rn memcpy(dat[n], d, (count + 1) * sizeof(double));rn rn rn // 行交换后,主对角线元素仍然为0,无解,返回-1rn if (dat[m][m] == 0.0)rn rn FreeData(dat, d, count);rn return -1;rn rn // 消元rn for (n = m + 1; n < count; n ++)rn rn tmp = dat[n][m] / dat[m][m];rn for (j = m; j < count; j ++)rn d[j] = 0.0;rn // 求得count - 1的元rn Answer[count - 1] = dat[count - 1][count] / dat[count - 1][count - 1];rn // 逐行代入求各元rn for (m = count - 2; m >= 0; m --)rn rn for (j = count - 1; j > m; j --)rn d[m] += Answer[j] * dat[m][j];rn Answer[m] = (dat[m][count] - d[m]) / dat[m][m];rn rn FreeData(dat, d, count);rn return 0;rn
在线等,vb代码翻译c#(10行)
Sub DataGrid_ItemCreated(Sender As Object, e As DataGridItemEventArgs)rnrn Select Case e.Item.ItemTypern Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItemrn Dim myTableCell As TableCellrn myTableCell = e.Item.Cells(0)rn Dim myDeleteButton As LinkButtonrn myDeleteButton = myTableCell.Controls(0)rn myDeleteButton.Attributes.Add("onclick","return confirm('Are you Sure you want to delete this company?');")rn End SelectrnEnd Subrn我想是这样rnpublic void DataGrid_ItemCreated(object source, System.Web.UI.WebControls.DataGridItemEventArgs e)rnrnif(e.Item.ItemType==ListItemType.EditItemrn||e.Item.ItemType==ListItemType.AlternatingItemrn||e.Item.ItemType==ListItemType.EditItem)rnrn TableCell myTableCell;rn myTableCell=e.Item.Cells[0];rn LinkButton lb;rn lb=myTableCell.Controls(0);rn lb.Attributes.Add("onclick","return confirm('Are you Sure you want to delete this company?')");rnrnrn可是编译不过去,错误:rnc:\inetpub\wwwroot\WebApplication2_2_2\WebForm1.aspx.cs(88): “System.Web.UI.Control.Controls”表示“属性”,此处应为“方法”rn请问我该怎么写?在线等,马上<em>给分</em>rn原文来自http://www.aspalliance.com/aldotnet/examples/confirmdeletecommandcolumn.txtrnrn
这句代码c#翻译vb.net,帮帮
[color=#FF0000]string viewStateID = (string)((Pair)base.LoadPageStateFromPersistenceMedium()).Second[/color]<em>c#</em><em><em>翻译</em>成</em>vb.net
这句VB代码怎么翻译C#?
private Sub InitCommonControls Lib "comctl32.dll" ()
求把一段C#代码翻译Delphi
[DllImport("mmtools.dll", CallingConvention = CallingConvention.Cdecl)]rn public static extern void WxSetDeviceInfo(int pWorker, tagDeviceInfo[] pDeviceInfo);rnrnrn public struct tagDeviceInforn rn public string ostype;rn public string devicebrand;rnrn}rnrnrn List list = new List();rn tagDeviceInfo dev = new tagDeviceInfo();rnrnlist.Add(dev);rnWxSetDeviceInfo(worker, list.ToArray());rn
谁能把这段C#代码翻译VB.NET
[DllImport("Iphlpapi.dll")]rnprivate static unsafe extern int SendARP(Int32 dest,Int32 host,ref IntPtr mac,ref IntPtr length);rn[DllImport("Ws2_32.dll")]rnprivate static extern Int32 inet_addr(string ip);rnrnInt32 ldest= inet_addr("157.60.68.163");//目的地的iprnInt32 lhost= inet_addr("157.60.68.33");//本地的iprnrntryrnrnByte[] macinfo=new Byte[6];rnInt32 length=6;rnrnIntPtr mac=new IntPtr(macinfo[0]);rnIntPtr len=new IntPtr(6);rnint ii=SendARP(ldest,lhost, ref mac, ref len);rnrnConsole.WriteLine("Mac Add:"+mac);rnConsole.WriteLine("length:"+len);rnrnrnrncatch(Exception err)rnrnConsole.WriteLine(err);rn rn
这句C#代码怎么翻译VB?
public event ExceptionEventHandler ExceptionOccurrs; //发生异常事件 rnrnif (this.ExceptionOccurrs != null) rnrn
有没有人会翻译这个,请帮忙翻译C语言
判断点px是否在多边形内rn'判断点px是否在多边形内;rn'即可适用于凹多边形的判断,也适用于凸多边形的判断rn'所选射线px(x0 y0)--pxy(x0+2*max|x0-xi| y0+min|y0-yi|) [i=1,2 3,.......,n]不与多边形任何一点相交rn'入口参数多边形:(n, ptx(), pty(), px , py)rn'返回值False (在多边形外)、True(在多边形上及在多边形内)rnrnPublic Function dzdbxn(n As Long, ptx() As Double, pty() As Double, px As Double, py As Double) As Booleanrn Dim j As Long rn Dim d1 As Double rn Dim d2 As Double rn Dim d3 As Doublernrn dzdbxn = Falsernrn For i = 1 To nrn j = i + 1: If i = n Then j = 1 rn d1 = Abs(ptx(i) * pty(j) + ptx(j) * py + px * pty(i) - ptx(i) * py - ptx(j) * pty(i) - px * pty(j)) rn d2 = Pold(ptx(i), pty(i), ptx(j), pty(j)) rn d3 = Abs(d2 - Pold(ptx(i), pty(i), px, py) - Pold(ptx(j), pty(j), px, py)) rn d1 = d1 / d2 rn Print "i=" + Str(i) + " j=" + Str(j) + " d1=" + Str(d1) + " d3=" + Str(d3)rn '注意:d1 d3判断值1前的0个数=多边形区域坐标值中小数位数-1rn If d1 < 0.0001 And d3 < 0.0001 Then dzdbxn = True: Exit Function rn Next i rnrn If dzdbxn = False Then rn Dim dx As Double rn Dim xmax As Double rn Dim dy As Double rn Dim ymin As Double rn rn For i = 1 To n rn dx = Abs(ptx(i) - px): dy = Abs(pty(i) - py) rn If i = 1 Then rn xmax = dx: ymin = dy rn Else rn If dx > xmax Then xmax = dx rn If dy < ymin Then ymin = dy rn End Ifrn Next i rnrn Dim sum As Long rn rn sum = 0: xmax = 2# * xmax rn For i = 1 To n rn j = i + 1: If i = n Then j = 1 rn d1 = ymin * (ptx(j) - ptx(i)) - xmax * (pty(j) - pty(i)) rn d2 = xmax * (pty(i) - py) - ymin * (ptx(i) - px) rn d3 = (ptx(j) - ptx(i)) * (pty(i) - py) - (pty(j) - pty(i)) * (ptx(i) - px) rn If (d2 * (d1 - d2)) >= 0# And d3 * d1 >= 0# Then sum = sum + 1 rn Next i rn Print "sum=" + Str(sum) + " px=" + Str(px) + " py=" + Str(py) rn If sum > 0 And sum <> 2 * Int(sum / 2) Then rn dzdbxn = True rn Else rn dzdbxn = False rn End If rn End IfrnEnd FunctionrnFunction Pold(x1 As Double, y1 As Double, x2 As Double, y2 As Double) As Double rn'两点间距离计算 rn Pold = Sqr((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))rnEnd Functionrn
帮帮忙,帮我翻译一下这段delphi的代码翻译bcb
rninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,rn Dialogs, ComCtrls, StdCtrls, ExtCtrls, DateUtils;rnrntypern TForm1 = class(TForm)rn ListView2: TListView;rn Panel1: TPanel;rn Label1: TLabel;rn txtName: TEdit;rn Label2: TLabel;rn txtRate: TEdit;rn Label3: TLabel;rn cmbStart: TDateTimePicker;rn Label4: TLabel;rn cmbEnd: TDateTimePicker;rn Button1: TButton;rn lvwMac: TListView;rn Label5: TLabel;rn txtTotal: TEdit;rn Label6: TLabel;rn Button2: TButton;rn cmbStartDate: TDateTimePicker;rn cmbStartTime: TDateTimePicker;rn Button3: TButton;rn procedure Button1Click(Sender: TObject);rn procedure Button2Click(Sender: TObject);rn procedure Button3Click(Sender: TObject);rn privatern procedure FillMacList;rn procedure CreateHeadCol;rn Private declarations rn publicrn Public declarations rn end;rnrn TMac = recordrn MacName: string;rn Rate: integer;rn StartTime: TDateTime;rn EndTime: TDateTime;rn Cur: integer; //本轮产品rn Storage: integer; //存量rn InOver: boolean; //是否生产完成rn Status: string; //设备当前状态rn end;rnrnvarrn Form1: TForm1;rn Macs: array of TMac;rnrnimplementationrnrn$R *.dfmrnrnprocedure TForm1.Button1Click(Sender: TObject);rnvarrn Mac: TMac;rnbeginrn Mac.MacName := txtName.Text;rn Mac.Rate := strtoint(txtRate.Text);rn Mac.StartTime := cmbStart.DateTime - int(cmbStart.DateTime);rn Mac.EndTime := cmbEnd.DateTime - int(cmbEnd.DateTime);rn Mac.InOver := false;rn Mac.Cur := 0;rn Mac.Storage := 0;rn Setlength(Macs, length(Macs) + 1);rn Macs[length(Macs) - 1] := Mac;rn FillMacList;rnend;rnrnprocedure TForm1.FillMacList;rnvarrn Item: TListItem;rn i: integer;rnbeginrn lvwMac.Clear;rn for i := 0 to length(Macs) - 1 dorn beginrn Item := lvwMac.Items.Add;rn Item.Caption := inttostr(lvwMac.Items.Count);rn Item.SubItems.Add(Macs[i].MacName);rn Item.SubItems.Add(inttostr(Macs[i].Rate));rn Item.SubItems.Add(TimeToStr(Macs[i].StartTime));rn Item.SubItems.Add(TimeToStr(Macs[i].EndTime));rn end;rnend;rnrnprocedure TForm1.Button2Click(Sender: TObject);rnvarrn iTotal: integer; //原料总数rn dtCur: TDateTime; //当前时间rn i, j: integer;rn iRate4: integer; //4小时的产量rn item: TListItem;rnbeginrn CreateHeadCol;rn for j := 0 to length(Macs) - 1 dorn beginrn Macs[j].InOver := false;rn Macs[j].Cur := 0;rn Macs[j].Storage := 0;rn end;rn ListView2.Clear;rn iTotal := strtoint(txtTotal.Text);rn dtCur := int(cmbStartDate.DateTime) +rn cmbStartTime.DateTime - int(cmbStartTime.DateTime);rn while true dorn beginrn //是否在工作的时间段rn if (int(dtCur * 1440) >= int((int(dtCur) + Macs[0].StartTime) * 1440))rn and (int(dtCur * 1440) < int((int(dtCur) + Macs[0].EndTime) * 1440)) thenrn beginrn Macs[0].InOver := iTotal = 0;rn Macs[0].Storage := Macs[0].Storage + Macs[0].Cur;rn Macs[0].Cur := 0;rn iRate4 := Macs[0].Rate * 4;rn if iRate4 = int((int(dtCur) + Macs[i].StartTime) * 1440))rn and (int(dtCur * 1440) < int((int(dtCur) + Macs[i].EndTime) * 1440)) thenrn beginrn Macs[i].InOver := (Macs[i - 1].Storage = 0) and Macs[i-1].InOver;rn Macs[i].Storage := Macs[i].Storage + Macs[i].Cur;rn Macs[i].Cur := 0;rn iRate4 := Macs[i].Rate * 4;rn if iRate4 ;rn Item.Width := 100;rn for i := 0 to length(Macs) - 1 dorn beginrn Item := ListView2.Columns.Add;rn Item.Caption := Macs[i].MacName;rn end;rnend;rnrnprocedure TForm1.Button3Click(Sender: TObject);rnbeginrn SetLength(Macs, 0);rn FillMacList;rnend;rnrnend.rn
翻译题,翻译delphi的代码,转换LPCSTR 为LPWSTR
1、#define SAFE_FREESTRING(s) if (s) DsoMemFree(s); (s) = NULL; rnrn2、STDAPI_(LPWSTR) ConvertToLPWSTR(LPCSTR pszMbcsString)rnrn3、主要是这个部分rnLPCLSID lpMyList = NULL;rnint nMyCount = 0;rnint nMyLen = 0;rnrnHKEY hkCLSID;rnHKEY hkItem;rnHKEY hkDocObject;rnDWORD dwIndex = 0;rnCHAR szName[MAX_PATH+1]; rnrnif (RegOpenKeyEx(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ|KEY_ENUMERATE_SUB_KEYS, &hkCLSID) == ERROR_SUCCESS)rnrn while (RegEnumKey(hkCLSID, dwIndex++, szName, MAX_PATH) == ERROR_SUCCESS)rn rn if (RegOpenKeyEx(hkCLSID, szName, 0, KEY_READ, &hkItem) == ERROR_SUCCESS)rn rn if ((RegOpenKeyEx(hkItem, "DocObject", 0, KEY_READ, &hkDocObject) != ERROR_SUCCESS))rn rn CLSID clsid;rn LPWSTR pwszClsid = ConvertToLPWSTR(szName);rn if ((pwszClsid) && SUCCEEDED(CLSIDFromString(pwszClsid, &clsid)))rn rn if (lpMyList == NULL)rn rn nMyCount = 0;rn nMyLen = 16;rn lpMyList = My CLSID[nMyLen];rn rn if (nMyCount == nMyLen)rn rn LPCLSID lpOldList = lpMyList;rn nMyLen <<= 2;rn lpMyList = My CLSID[nMyLen];rn memcpy(lpMyList, lpOldList, sizeof(CLSID) * nMyCount);rn delete [] lpOldList;rn rnrn lpMyList[nMyCount] = clsid;rn nMyCount++;rn rn SAFE_FREESTRING(pwszClsid);rn RegCloseKey(hkDocObject);rn rn rn RegCloseKey(hkItem);rn rn rn RegCloseKey(hkCLSID);rn
翻译,C代码转delphi代码
求<em>翻译</em>,好久没用delphi写过这种东西了,已 经<em>翻译</em>不能了rn别外,delphi的string怎么转成unsigned char* 对应的类型,然后再又怎么转回string?rnrnrn#define MAKS 0x55 rn#define P_START 0xec rn#define P_END 0xdc rn#define CMAXLEN 10240 rnrnbool Encode(unsigned short cmd,unsigned char* content,int clen,unsigned char* pag)rnrn if(clen>CMAXLEN||clen>8)&0xff;rn pag[3]= clen&0xff;rn pag[4]= (clen>>8)&0xff;rn pag[5]= (clen>>16)&0xff;rn pag[6]= (clen>>24)&0xff;rn unsigned char* verify=pag+7+clen;rn *verify=MAKS;rn for(int i=0;i=plen-1) return false;rn while(pag[offset]!=P_START)rn rn ++offset;rn if(offset>=plen) return false;rn rn rn memcpy(&clen,pag+offset+3,4);rn if(clen>CMAXLEN)rn ++offset;rn goto REDE;rn rn if(offset+clen>plen-9)rn return false;rn if(pag[offset+8+clen]!=P_END)rn rn ++offset;rn goto REDE;rn rn unsigned char ver = MAKS;rn for(int i=0;i
Head First C# 中文版 第九章 读写文件 翻译完毕 PDF下载
Head First C# 中文版 第九章 读写文件 <em>翻译</em><em>完毕</em> PDF下载 http://blog.csdn.net/cuipengfei1
BCB代码翻译VB代码
for(LeftStep=0;LeftStep>iBit;rn temp=temp<
c翻译pas
以下一段<em>代码</em>是从MSDN拷贝过来的,关于从一个文件夹复制到另外一个文件夹.麻烦哪位大侠<em><em>翻译</em>成</em>rndelphi的pas,谢谢rnrn#include rn#include rnrnmain()rnrn IShellFolder *psfDeskTop = NULL;rn IShellFolder *psfDocFiles = NULL;rn IMalloc *pMalloc = NULL;rn LPITEMIDLIST pidlDocFiles = NULL;rn LPITEMIDLIST pidlItems = NULL;rn IEnumIDList *ppenum = NULL;rn SHFILEOPSTRUCT sfo;rn STRRET strDispName;rn TCHAR szParseName[MAX_PATH];rn TCHAR szSourceFiles[256];rn int i;rn int iBufPos = 0;rn ULONG chEaten;rn ULONG celtFetched;rn HRESULT hr;rnrn pzSourceFiles[0] = '\0';rn hr = SHGetMalloc(&pMalloc);rn hr = SHGetDesktopFolder(&psfDeskTop);rnrn hr = psfDeskTop->ParseDisplayName(NULL, NULL, L"c:\\My_Docs", rn &chEaten, &pidlDocFiles, NULL);rn hr = psfDeskTop->BindToObject(pidlDocFiles, NULL, IID_IShellFolder, rn (LPVOID *) &psfDocFiles);rn hr = psfDeskTop->Release();rnrn hr = psfDocFiles->EnumObjects(NULL,SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, rn &ppenum);rnrn while( (hr = ppenum->Next(1,&pidlItems, &celtFetched)) == S_OK rn && (celtFetched) == 1)rn rn psfDocFiles->GetDisplayNameOf(pidlItems, SHGDN_FORPARSING, rn &strDispName);rn StrRetToBuf(&strDispName, pidlItems, szParseName, MAX_PATH);rn for(i=0;iFree(pidlItems);rn rn ppenum->Release();rn rn szSourceFiles[iBufPos] = '\0';rnrn sfo.hwnd = NULL;rn sfo.wFunc = FO_COPY;rn sfo.pFrom = szSourceFiles;rn sfo.pTo = "c:\\My_Docs2\0";rn sfo.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR;rnrn hr = SHFileOperation(&sfo);rn rn SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH, (LPCVOID) "c:\My_Docs2", 0);rnrn pMalloc->Free(pidlDocFiles);rn psfDocFiles->Release();rnrn return 0;rn
C++代码翻译delphi代码
C++<em>代码</em>如下:rn int Query_Pos_Card12(HANDLE icdev,LPINT CardType, LPINT Opt_Num, LPINT Serno,LPSTR Cardno, rnunsgind long * CardSerno, LPINT Value,LPINT Count,LPINT UserType,,LPINT Consum_Add, LPINT use_term , rnint WaitTime) rnrn并且给出在delphi中如何调用,我的调用过程如下:rnprocedure TForm1.Button2Click(Sender: TObject);rnvarrn MlngCardID:PInteger; //卡流水号rn MstrPressWorkID:string; //用户对外编号rn MlngCardTypeID:PInteger; //卡类型(0 - 用户卡,1 - 操作员卡,2 - 系统卡,4 - 空白卡)rn MlngValue1:PInteger; //卡剩余金额:实际金额*100rn MlngCount1:PInteger; //卡消费次数rn MLngConsumAdd:PInteger; //上次消费的消费机地址rn MLngUseTerm:PInteger; //单位为月,+GetCardErr(intRet));rn Dispose(MlngFactoryFixID);rn Dispose(MlngCardID);rn //Dispose(MstrPressWorkID);rn Dispose(MlngCardTypeID);rn Dispose(MlngValue1);rn Dispose(MlngCount1);rn Dispose(MLngConsumAdd);rn Dispose(MLngUseTerm);rn Dispose(MlngSaleOperatorID);rn Dispose(MlngAddCount);rn Dispose(MlngCardUsageType);rnend;
汇编翻译C
哪位大侠帮助小弟把下面一小段汇编<em><em>翻译</em>成</em>C,谢谢大家关注rn00411A20 push ebprn00411A21 mov ebp,esprn00411A23 sub esp,0E8hrn00411A29 push ebxrn00411A2A push esirn00411A2B push edirn00411A2C lea edi,[ebp-0E8h]rn00411A32 mov ecx,3Ahrn00411A37 mov eax,0CCCCCCCChrn00411A3C rep stos dword ptr [edi]rn00411A3E mov eax, dword ptr [a]rn00411A41 add eax, dword ptr [b]rn00411A44 mov dword ptr [d],eaxrn00411A47 mov dword ptr [i],1rn00411A4E mov dword ptr [c],0rn00411A55 cmp dword ptr [c],64hrn00411A59 jge myfunction+46h (411A66h)rn00411A5B mov eax,dword ptr [c]rn00411A5E add eax,dword ptr [i]rn00411A61 mov dword ptr [c],eaxrn00411A64 jmp myfunction+35h (411A55h)rn00411A66 mov eax,dword ptr [c]rn00411A69 mov dword ptr [ebp-0E8h],eaxrn00411A6F cmp dword ptr [ebp-0E8h],0rn00411A76 je myfunction+63h (411A83h)rn00411A78 cmp dword ptr [ebp-0E8h],1rn00411A7F je myfunction+6Ah (411A8Ah)rn00411A81 jmp myfunction+72h (411A92h)rn00411A83 mov dword ptr [d],1rn00411A8A mov eax,dword ptr [c]rn00411A8D mov dword ptr [d],eaxrn00411A90 jmp myfunction+79h (411A99h)rn00411A92 mov dword ptr [d],0rn00411A99 mov eax,dword ptr [d]rn00411A9C pop edirn00411A9D pop esirn00411A9E pop ebxrn00411A9F mov esp,ebprn00411AA1 pop ebprn00411AA2 retrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn
汇编翻译c的问题
mov al, [edi+4] ; v20 = *(_BYTE *)(v7 + 4)rnmov dl, [edi+3] ; v21 = *(_BYTE *)(v7 + 3);rnxor byte ptr [esp+40h+var_18+1], cl ; *(WORD *)((char *)&v42 + 1) ^=rn __PAIR__(*(BYTE *)(v7 + 2), *(BYTE *)(v7 + 1))rnrnida得到得结果,rn*(WORD *)((char *)&v42 + 1) ^= __PAIR__(*(BYTE *)(v7 + 2), *(BYTE *)(v7 + 1))rn这句怎么理解呢?
pl0翻译C的问题
如下一个pl0程序rnvar a,b;rnprocedure Ad;rn var d;rn procedure Bd;rn var c;rn beginrn c:=3;rn b:=c+a+drn end;rn beginrn d:=5;rn a:=a+1;rn call Bdrn end;rnbeginrn a:=5;rn b:=0;rn call Ad;rn write(b)rnend.rnrn结果输出b的值14rnpl0支持过程嵌套,但是C不支持,难道把所有子过程的参数都rn在C中转为全局变量的方法实现?求解最合适的方法,不甚感激。
c翻译delphi
[code=c]unsigned short CRC16(puchMsg, usDataLen) rn//unsigned char *puchMsg; /* 要进行CRC校验的消息 */ rn//unsigned short usDataLen; /* 消息中字节数 */ rn rn unsigned char uchCRCHi = 0xFF ; /* 高CRC字节初始化 */rn unsigned char uchCRCLo = 0xFF ; /* 低CRC 字节初始化 */rn unsigned uIndex ; /* CRC循环中的索引 */rn while (usDataLen--) /* 传输消息缓冲区 */rn rn uIndex = uchCRCLo ^ *puchMsg++ ; /* 计算CRC */rn uchCRCLo = uchCRCHi ^ auchCRCHi[uIndex] ;rn uchCRCHi = auchCRCLo[uIndex] ;rn rn return (uchCRCHi << 8 | uchCRCLo) ;rn rn[/code]rnrn哪位可以帮我<em><em>翻译</em>成</em>delphi,其中auchCRCLo和auchCRCHi是CRC字节表
帮助翻译,必给分!!!
将我公司在全国的同步网调整和改造到以SDH传输网为定时链路的新型同步网结构;rn
silverlight1.1 代码翻译silverlight2.0的代码
<em>代码</em><em>翻译</em>,Foreground,Subtitle,Title在sl2.0开发中变成什么了?rnrnpublic class PageInfornrn // Fieldsrn [CompilerGenerated]rn private Canvas k__BackingField;rn [CompilerGenerated]rn private string k__BackingField;rn [CompilerGenerated]rn private string k__BackingField;rn [CompilerGenerated]rn private string k__BackingField;rn [CompilerGenerated]rn private string k__BackingField;rnrn // Propertiesrn public Canvas Canvasrn rn [CompilerGenerated]rn getrn rn return this. k__BackingField;rn rn internal [CompilerGenerated]rn setrn rn this. k__BackingField = value;rn rn rnrn public string Foregroundrn rn [CompilerGenerated]rn getrn rn return this.k__BackingField;rn rn internal [CompilerGenerated]rn setrn rn this.k__BackingField = value;rn rn rnrn public string Pathrn rn [CompilerGenerated]rn getrn rn return this.k__BackingField;rn rn internal [CompilerGenerated]rn setrn rn this.k__BackingField = value;rn rn rnrn public string Subtitlern rn [CompilerGenerated]rn getrn rn return this.k__BackingField;rn rn internal [CompilerGenerated]rn setrn rn this.k__BackingField = value;rn rn rnrn public string Titlern rn [CompilerGenerated]rn getrn rn return this. k__BackingField;rn rn internal [CompilerGenerated]rn setrn rn this. k__BackingField = value;rn rn rnrnrn
C头文件翻译DELPHI
This Zip File includes the latest version of Bob Swart‘s (aka Dr. Bob) Header Converter Utility whose purpose is to translate C header files into Delphi interface units. In an earlier release, Dr. Bob described the tool in these words: "HeadConv v4.20 is capable of generating implicit and explicit Delphi import units (16/32-bit compatible) for C DLL header files. Please note that HeadConv is not perfect (it will fail on complex structures) and on average "only" has a 85-90% correct conversion rate - there‘s always some handwork required before and after converting the header files - see also my article on Using C DLLs with Delphi at http://www.drbob42.com/delphi/headconv.htm." Several years ago Dr. Bob donated this utility to Project JEDI to aid in its header translations. Some time later Alan C. Moore, a member of Project JEDI, began the process of re-factoring the source code to improve its readability in preparation for its official release to Project JEDI. These files are the culmination of that process. Folders and Files Readme.txt this file Samples/Sample.h Sample header file to test translations Source/Headconv.dpr Main Delphi project file for building utility Source/Headpars.pas Main parsing unit for converting header files Source/Headutil.pas Utility functions used in Headpars.pas Source/Headvars.pas Global variables used in other units. Because of technical limitations we are unable to include the executable that accomplishes header translations, Bin/HeadConv.exe. This file will continue to be available at Dr. Bob‘s Website in the "tools" section at http://www.drbob42.com/tools/index.htm.
C#翻译VB.
public int UserManarn rn getrn rn return userMana;rn rn setrn rn userMana = value;rn rn rn
C++语法翻译c#
#define WM_CODE_CHANGE WM_USER+100rnrnUINT uMsg = WM_CODE_CHANGE;rnrn //启动外部程序rn Stock_Init(this->m_hWnd,uMsg,"XX系统.EXE");rnrn while(1)rn rn HWND hwnd = GetHQExeHWND();rnrn m_pWndExtern = CWnd::FromHandle(hwnd); //重点在这边,<em>c#</em>似乎没有啊rnrn if (m_pWndExtern)rn rn if (IsWindow(m_pWndExtern->m_hWnd))rn rn this->SetWindowPos(NULL, 0, 0, 800, 600, 0);rn this->CenterWindow();rnrn m_pWndExtern->ModifyStyle( WS_CAPTION | WS_THICKFRAME, 0);rn m_pWndExtern->SetParent(this);rnrn CRect rect;rn GetClientRect(&rect);rnrn CPoint pt = rect.TopLeft();rn ClientToScreen(&pt);rn ScreenToClient(&pt);rnrn m_pWndExtern->SetWindowPos(NULL, pt.x, pt.y, rect.Width(), rect.Height(), 0);rnrn break;rn rnrn rnrn Sleep(500);rn rnrnrn return TRUE; // 除非将焦点设置到控件,否则返回 TRUErnrnrnLRESULT CLaodExeTestDlg::OnCodeChange(WPARAM wp,LPARAM lp)rnrn GOOGSINFO* pCodeInfo = (GOOGSINFO*)lp;rnrn if (pCodeInfo == NULL)rn rn return 0;rn rnrnrnrn CString strInfo;rnrn strInfo.Format("名称:%s,<em>代码</em>:%s",pCodeInfo->m_szCode,pCodeInfo->m_szName);rnrn AfxMessageBox(strInfo);rnrn return 0;rn
求大神翻译C#
(.*)/iUs';rn preg_match_all ( $preg, $result, $match );rn $response_msg = $match [0] [0];rn $preg = "/]+>/i";rn $response_msg = preg_replace ( $preg, '', $response_msg );rn if ("hello,how are you" == $response_msg || "how do you do" == $response_msg) rn $response_msg = "小i机器人欢迎您,作者主页地址:50vip.com。小i机器人不断学习中,欢迎各种调戏.../:,@-D"; // 欢迎语rn rn $response_msg = trim ( $response_msg );rn echo $response_msg;rn?>
delphi翻译C#
delphi<em>代码</em>: chr($FF) + chr($FF) + chr($FF) + chr($20)+ chr($1) + chr($1) + chr(0) + chr(31) +'LOGIN这是登陆字符串'rnrn如何转换为C#<em>代码</em>???
C#翻译VB.Net
100分 请人帮我把这个例子<em><em>翻译</em>成</em>VB.Net 例子很短rnhttp://www.csharpwin.com/csharpresource/1982.shtmlrnC# 在菜单、工具栏、状态栏上显示任意WinForm控件rn或者是相同功能的类rn效果类似rn[img=http://hi.csdn.net/attachment/201010/12/132021_1286849069nFts.png][/img]rnrn我希望得到的是一个完整做好的类,我<em>直接</em>能用的rn做好后可以<em>直接</em>将类贴出来或发送到我的邮箱502138102@qq.com
C#翻译VB.net
这句<em>代码</em><em><em>翻译</em>成</em>vb.net 怎么写?rniRes = RY3_Find(sVendorID, ref iCount);rn
--------------怎样翻译C#语句------------------
dim Nd,i,pwdrnpwd="xxxxx"rnfor i = 1 to len(pwd)rnNd = Nd + chrw(ascw(mid(pwd,i,1)) + ascw(right(cstr(i*i),i)))rnnext
C程序翻译汇编语言
求助汇编高手,请把这段C程序<em><em>翻译</em>成</em>汇编语言, 急!请汇编高手把这段C程序<em><em>翻译</em>成</em>汇编语言,并附解释,谢谢!比较急,明天下午选标。#include #include #define uint unsigned int#define uchar unsigned charsbit led1 = P2^0;sbit ledlk = P1^0;sbit smglk = P1^1;sbit smgbitlk
asp代码翻译asp.net
Public Function WordPercent(ss)rn On Error resume nextrn '汉字占用Hex = 4个字长,英文占用2个字长,让一个汉字算为2个英文字符,计算有效字符比例rn Dim i, xrn Dim Wordrn Dim ch1,ch2rn rn Dim OriLengthrn Dim RealLenrn OriLength = Len(ss)rn rn If OriLength=0 thenrn WordPercent = 0rn Exit Functionrn End ifrn rn i = 0rn If ss <> "" Thenrn For x = 1 To Len(ss)rn rn 'Response.Write Asc(Mid(ss, x, 1)) & "==" & Hex(Asc(Mid(ss, x, 1))) & chr(Asc(Mid(ss, x, 1)))rn rn Word = Hex(Asc(Mid(ss, x, 1)))rn If Len(Word) > 2 Thenrn ch1 = HextoOct(left(Word,2))rn ch2 = HextoOct(right(Word,2))rn 'GB2312字符集范围rn If ch1>=176 and ch1=160 and ch2rn WordPercent = Clng(RealLen / (OriLength + RealLen/2) * 100)rn rn End Functionrnrnrn帮忙帮我<em><em>翻译</em>成</em> C#的。。。。。这个自己看了不能完全看懂,怕出错
vb代码翻译delphi
Public Function tx_read_frame(leixing As Byte, data1 As Byte, data2 As Byte, data3 As Byte, data4 As Byte)rn Static Byteout(0 To 7) As Byte, i As Byte '向外发送rn Dim sum As Integerrn Byteout(0) = &H55rn Byteout(1) = 1rn Byteout(2) = leixingrn Byteout(3) = data1rn Byteout(4) = data2rn Byteout(5) = data3rn Byteout(6) = data4rn sum = 0rn For i = 0 To 6 Step 1rn sum = sum + Byteout(i)rn Nextrn Byteout(7) = sum Mod 256rn main_form.MSComm1.InBufferCount = 0rn main_form.MSComm1.Output = ByteoutrnEnd Functionrn---rn以上函数用delphi应该怎么写,望指教
vc代码翻译delphi
#define MAX_DATACODEWORD 2956rnWORD wData;rnint nIndex;rnBYTE m_byDataCodeWord[MAX_DATACODEWORD];rnrn--------------------------------------rnif (wData & (1 << (ncData - i - 1)))rnrn m_byDataCodeWord[(nIndex + i) / 8] |= 1 << (7 - ((nIndex + i) % 8));rnrn--------------------------------------rn主要是线条中间的部分。
翻译delphi代码
[code=csharp]public Boolean WriteDoc(string path ,string filename, object obj)rn rn DirectoryInfo dFolder = new DirectoryInfo(path);rn if (!dFolder.Exists)rn rn dFolder.Create() ;rn rnrn Boolean ok = false;rn tryrn rn byte[] by = System.Convert.FromBase64String(obj.ToString());rnrn System.IO.FileStream fh = System.IO.File.Open(filename, System.IO.FileMode.Create);rnrn fh.Write(by, 0, by.Length);rnrn fh.Close();rn ok = true;rn rn catch(Exception ex)rn rn string str = ex.Message ; rn rn rn return ok ;rn [/code]
BIOS reading books下载
BIOS.PDFBIOS reading booksBIOS reading booksBIOS reading booksBIOS reading booksBIOS reading booksBIOS reading booksBIOS reading books 相关下载链接:[url=//download.csdn.net/download/faugeras/3068420?utm_source=bbsseo]//download.csdn.net/download/faugeras/3068420?utm_source=bbsseo[/url]
手机程序锁AppLock下载
手机程序锁(AppLock)是安卓上一款加密应用程序的安全类工具,它简单易操作,高效。可以同时多款软件程序加锁,比如手机短信,手机相册,手机图书软件,手机视频播放器,手机音乐播放器等都可以加锁,在进入软件程序的时候需要输入自己设定好的密码(初始密码:8888),密码不对则无法进入,不能正常使用软件。 更新2.0 本版本更新内容:修复部分bug,保存用户数据,添加推荐应用列表功能,美化输入密码界面,添加英文语言. 相关下载链接:[url=//download.csdn.net/download/icemanyandy/4049468?utm_source=bbsseo]//download.csdn.net/download/icemanyandy/4049468?utm_source=bbsseo[/url]
[原创]一个Hibernate的开发指南下载
junit.jar:JUnit测试框架包,编译时为测试代码进行测试所使用的。 optional.jar:Ant使用的辅助包,包括了一些附加的task。 相关下载链接:[url=//download.csdn.net/download/javajava1988/5091402?utm_source=bbsseo]//download.csdn.net/download/javajava1988/5091402?utm_source=bbsseo[/url]
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池
我们是很有底线的