想了老半天,用了很复杂的过程。。结果WA了,去问了别人,才知道,可以一个函数搞定
哎,水平还是不行,需要提高啊
#include <iostream>
using namespace std;
int main()
{
long n,x;
float m;
cin >> n)
while (n--)
{
cin >> m;
memcpy(&x,&m,4);
printf("%lX\n",x);
}
return 0;
}
想了老半天,用了很复杂的过程。。结果WA了,去问了别人,才知道,可以一个函数搞定
哎,水平还是不行,需要提高啊
#include <iostream>
using namespace std;
int main()
{
long n,x;
float m;
cin >> n)
while (n--)
{
cin >> m;
memcpy(&x,&m,4);
printf("%lX\n",x);
}
return 0;
}
转载于:https://www.cnblogs.com/cnnbboy/archive/2008/08/27/1278029.html