请问这几句JAVA代码如何转换成C++代码? returnValue = Integer.toHexString(accumulator).toUpperCase(); for (i=returnValue.length(); i<4; i++) returnValue = '0' + returnValue;C++无法获得数组的长度啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用C写的。char* g(unsigned int a) { char k[] = "0123456789ABCDEF"; char r[sizeof (a)*2]; int i = 0; while (a != 0) { r[i++] = k[a % 16]; a /= 16; } while (i < 4) { r[i++] = '0'; } char* t = malloc(i + 1); int j = 0; while (j < i) { t[j++] = r[i - 1 - j]; } t[i] = 0; return t;} String getCRC(byte[] arg) {int i, accumulator, data, index;String returnValue = new String();accumulator = 0xffff;for (i=0; i<arg.length; i++) {data = arg[i];index = (accumulator >> 8) ^ data;accumulator = (accumulator << 8) ^ this.crcTable[index];}accumulator ^= 0xffff;returnValue = Integer.toHexString(accumulator).toUpperCase();for (i=returnValue.length(); i<4; i++)returnValue = '0' + returnValue;return returnValue;} JAVA如何实现象 星际争霸 主机掉线 其他分机还可以继续通信的!? 求一个Demo SQL问题,请教 有关事件处理的一个问题 private有什么奥秘吗? java.util.Timer 的问题 头痛的问题. 那里有用Jbuilder连接在win2000下的SQLserver2000的驱动程序包下载?? 求高手点拨一个“JavaSE的程序中的"小异常"”. 一个JAVA继承的问题(Thinking in JAVA里的一个例子) 请问这段JAVA代码如何转换成C++代码? 把线程的值传回主类的疑惑。
char k[] = "0123456789ABCDEF";
char r[sizeof (a)*2];
int i = 0;
while (a != 0) {
r[i++] = k[a % 16];
a /= 16;
}
while (i < 4) {
r[i++] = '0';
}
char* t = malloc(i + 1);
int j = 0;
while (j < i) {
t[j++] = r[i - 1 - j];
}
t[i] = 0;
return t;
}
int i, accumulator, data, index;
String returnValue = new String();
accumulator = 0xffff;
for (i=0; i<arg.length; i++) {
data = arg[i];
index = (accumulator >> 8) ^ data;
accumulator = (accumulator << 8) ^ this.crcTable[index];
}
accumulator ^= 0xffff;
returnValue = Integer.toHexString(accumulator).toUpperCase();
for (i=returnValue.length(); i<4; i++)
returnValue = '0' + returnValue;
return returnValue;
}