那位肯费心的帮我把几条VB的代码翻译成VC的???编译通过的送100分.

ghw1977 2003-08-23 03:42:36
dim idatacount2,adatacount2,cdatacount2,ldatacount2,datacount2,datalength2
as integer
dim i as integer
dim sendbytes(2000) as byte
dim dataout as string
dim oddcheckby as byte
dim senddata(300) as double
-------------------------------
dataout=""
i=1
while i<=cint(idatacount2)
dataout=dataout&format(senddata(i),"000000")
i=i+1
wend
while i<=cint(adatacount2)+cint(idatacount2)
dataout=dataout&format(senddata(i),"00000.000")
i=i+1
wend

while i<=cint(adatacount2)+cint(idatacount2)+cint(cdatacount2)
dataout=dataout&format((senddata(i) Mod 2),"0")
i=i+1
wend

while i<=cint(adatacount2)+cint(idatacount2)+cint(cdatacount2)+cint(ldatacount)
dataout=dataout&format(senddata(i),"00000000000")
i=i+1
wend
for i=1 to datalength2
sendbytes(17+i)=Asc(Mid$(dataout,i,1))
next i
oddcheckbyte=&HFF
for i=0 to 17+datalength2
oddcheckbyte=oddcheckbyte Xor sendbytes(i)
next i
------------------------------
i=0
while para<=cint(idatacount2)

datastring=""
for j=1 to 6
datastring=datastring +Chr$(recdata(17+i*6+j)
next j
recdata(para)=cint(datastring)
para=para+1
i=i+1
wend
i=0
while para<=cint(idatacount2+adatacount)

datastring=""
for j=1 to 9
datastring=datastring +Chr$(recdata(17+i*6+j)
next j
recdata(para)=cdbl(datastring)
para=para+1
i=i+1
wend

i=1
while para<=cint(idatacount2)
recdata(para)=Val(Chr$(recdata(17+i*6+j))
para=para+1
i=i+1
wend
i=0
while para<=cint(idatacount2+adatacount)

datastring=""
for j=1 to 11
datastring=datastring +Chr$(recdata(17+i*6+j)
next j
recdata(para)=clng(datastring)
para=para+1
i=i+1
wend
dataviewer.text=""
for i=1 to 20
dataviewer.txt=dataviewer.txt+format(cstr(recdata(i),"@@@@@@@@@@@"+vbCrlf
next i

...全文
32 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
tangjiang 2003-08-24
  • 打赏
  • 举报
回复
dataout=dataout&format(senddata(i),"000000")
//CString dataout;
//CString strTemp;
//strTemp.Format("%05i", senddata[i]);
//datatout = dataout + strTemp;

dataout=dataout&format(senddata(i),"00000.000")
//CString strTemp2;
//strTemp2.Format("%00000010.3f", (float)(senddata[i]));
//datatout = dataout + strTemp2;

dataout=dataout&format((senddata(i) Mod 2),"0")
//CString strTemp3;
//strTemp3.Format("%01i", (senddata[i])/2); //求商用(senddata[i])/2,求余数用(senddata[i])%2


剩下的有空再看看。
fbmsf 2003-08-24
  • 打赏
  • 举报
回复
我想我可以帮你,wait.....
bcpl 2003-08-23
  • 打赏
  • 举报
回复
vb的代码本身就不清楚,怎么翻译
ghw1977 2003-08-23
  • 打赏
  • 举报
回复
??l来人??帮忙吗?
ghw1977 2003-08-23
  • 打赏
  • 举报
回复
to all
dataout=dataout&format(senddata(i),"000000")
dataout=dataout&format(senddata(i),"00000.000")
dataout=dataout&format((senddata(i) Mod 2),"0")
sendbytes(17+i)=Asc(Mid$(dataout,i,1))
oddcheckbyte=oddcheckbyte Xor sendbytes(i)
datastring=datastring +Chr$(recdata(17+i*6+j))
recdata(para)=Val(Chr$(recdata(17+i*6+j))
dataviewer.txt=dataviewer.txt+format(cstr(recdata(i),"@@@@@@@@@@@"+vbCrlf)
------------
变量的定义如下:
dim idatacount2,adatacount2,cdatacount2,ldatacount2,datacount2,datalength2
as integer
dim i as integer
dim sendbytes(2000) as byte
dim dataout as string
dim oddcheckby as byte
dim senddata(300) as double
dim revdata(20) as double
------
帮给转一下,!!!各位大侠1!!!!等........
zhang_zhibin 2003-08-23
  • 打赏
  • 举报
回复
加$说明是字符串,和QBASIC中一样。呵呵,早就不用了。还有点印象。
ghw1977 2003-08-23
  • 打赏
  • 举报
回复
dataout=dataout&format(senddata(i),"000000")
dataout=dataout&format(senddata(i),"00000.000")
dataout=dataout&format((senddata(i) Mod 2),"0")
sendbytes(17+i)=Asc(Mid$(dataout,i,1))
oddcheckbyte=oddcheckbyte Xor sendbytes(i)
datastring=datastring +Chr$(recdata(17+i*6+j))
recdata(para)=Val(Chr$(recdata(17+i*6+j))
dataviewer.txt=dataviewer.txt+format(cstr(recdata(i),"@@@@@@@@@@@"+vbCrlf)
------------
变量的定义如下:
dim idatacount2,adatacount2,cdatacount2,ldatacount2,datacount2,datalength2
as integer
dim i as integer
dim sendbytes(2000) as byte
dim dataout as string
dim oddcheckby as byte
dim senddata(300) as double
dim revdata(20) as double
-------------
(chr$ mid$ 加个$有什么用?Val(Chr$()),Asc(Mid$())怎么转?)

ghw1977 2003-08-23
  • 打赏
  • 举报
回复
你们就当练练手拉~~.我转了半天也不对呀
zhouyong0371 2003-08-23
  • 打赏
  • 举报
回复
我看后感觉有点晕,应该很好转吧?嗬嗬
ghw1977 2003-08-23
  • 打赏
  • 举报
回复
你多看几秒钟就会发现,其实不长,关键就几句.其他类似的.
dataout=dataout&format(senddata(i),"000000")
dataout=dataout&format(senddata(i),"00000.000")
dataout=dataout&format((senddata(i) Mod 2),"0")
sendbytes(17+i)=Asc(Mid$(dataout,i,1))
oddcheckbyte=oddcheckbyte Xor sendbytes(i)
datastring=datastring +Chr$(recdata(17+i*6+j)
recdata(para)=Val(Chr$(recdata(17+i*6+j))
dataviewer.txt=dataviewer.txt+format(cstr(recdata(i),"@@@@@@@@@@@"+vbCrlf
一共8条,把这8句翻译成vc的就可以了!!!求助呀~!~!等待.........
难道100分少吗吗///???
peterguan 2003-08-23
  • 打赏
  • 举报
回复
那么长?

16,470

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧