69,370
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<string.h>
using namespace std;
int main() {
int s[11]{ 0x5, 0xc5, 0xb3, 0xea };
char str[100];
for (int i = 0; i < 4; i++)
sprintf(str + i * 2, %02x", (usigned char)s[i]);
printf("%s", str);
return 0;
}
#include<iostream>
#include<string.h>
using namespace std;
int main() {
int s[11]{ 0x5, 0xc5, 0xb3, 0xea };
char str[100];
char tmp[10];
str[0]=0;
for (int i = 0; i < 4; i++)
sprintf(str, "%s%02x",str,(usigned char)s[i]);
printf("%s", str);
return 0;
}
#include<iostream>
#include<string.h>
using namespace std;
int main() {
int s[] = { 0x5, 0xc5, 0xb3, 0xea };
char str[1024]={};
for (int i = 0; i < ARRAYSIZE(s); i++)
sprintf(&str[strlen(str)], "%02x", s[i]);
printf("%s", str);
return 0;
}
#include<iostream>
#include<string.h>
using namespace std;
int main() {
int s[11]{ 0x5, 0xc5, 0xb3, 0xea };
char str[100]="";
char tmp[10];
for (int i = 0; i < 4; i++)
sprintf(&str[strlen(str)], "%02s", itoa(s[i], tmp, 16));
printf("%s", str);
return 0;
}