• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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


Commit MetaInfo

Revisión1 (tree)
Tiempo2014-06-01 22:39:03
Autorxops-mikan

Log Message

(empty log message)

Cambiar Resumen

Diferencia incremental

--- 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