HDU 1265(Floating Point Presentation)

主要使用 cstring 的库函数 memcpy,函数功能是从源内存地址的起始位置拷贝若干个字节到目标内存地址。

#include <cstdio>
#include <cstring>

int main()
{
	int N;
	scanf("%d", &N);
	long x;
	float num;
	while (N--)
	{
		scanf("%f", &num);
		memcpy(&x, &num, 4);
		printf("%lX\n", x);
	}
	return 0;
}

继续加油。

发布了206 篇原创文章 · 获赞 1 · 访问量 8998

猜你喜欢

转载自blog.csdn.net/Intelligence1028/article/details/104790677
今日推荐