• R/O
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

小数値(32bit Float)から4バイトのバイナリを求めるツールです。


Commit MetaInfo

修订版1 (tree)
时间2014-06-01 22:39:03
作者xops-mikan

Log Message

(empty log message)

更改概述

差异

--- 32bitFloatBinary.cpp (nonexistent)
+++ 32bitFloatBinary.cpp (revision 1)
@@ -0,0 +1,28 @@
1+#include <stdio.h>
2+#include <windows.h>
3+
4+union ufloat {
5+ float f;
6+ unsigned u;
7+};
8+
9+int main()
10+{
11+ ufloat u1;
12+ float x;
13+
14+ printf("数値を入力してください > ");
15+ scanf("%f", &x);
16+ u1.f = x;
17+
18+ //printf("%X", u1.u);
19+ printf("%02X ", (unsigned char)(u1.u&0x000000FF));
20+ printf("%02X ", (unsigned char)((u1.u&0x0000FF00) >> 8));
21+ printf("%02X ", (unsigned char)((u1.u&0x00FF0000) >> 16));
22+ printf("%02X ", (unsigned char)((u1.u&0xFF000000) >> 24));
23+
24+ printf("\n");
25+ system("pause");
26+
27+ return 0;
28+}
\ No newline at end of file