diff --git a/hex2decimal.cpp b/hex2decimal.cpp new file mode 100644 index 0000000..145b04b --- /dev/null +++ b/hex2decimal.cpp @@ -0,0 +1,33 @@ +#define _CRT_SECURE_NO_DEPRECATE +#include +#include +#include +#include + +int main(int argc, char const* argv[]) +{ + + if (argc != 2) + { + printf("%s 十六进制的数值\n", argv[0]); + return -1; + } + + uint64_t input_num = 0; + sscanf(argv[1], "0x%x", &input_num); + + + int8_t int8_t_value = (int8_t)input_num; + int16_t int16_t_value = (int16_t)input_num; + int32_t int32_t_value = (int32_t)input_num; + int64_t int64_t_value = (int64_t)input_num; + printf("input : 0x%x\n", input_num); + printf("========================================\n"); + printf("= int8_t_value : %d\n", int8_t_value); + printf("= int16_t_value: %d\n", int16_t_value); + printf("=int32_t_value: %d\n", int32_t_value); + printf("= int64_t_value: %ld\n", int64_t_value); + printf("=\n"); + + return 0; +} \ No newline at end of file diff --git a/hex2decimal.sln b/hex2decimal.sln new file mode 100644 index 0000000..02fef9e --- /dev/null +++ b/hex2decimal.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hex2decimal", "hex2decimal.vcxproj", "{6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Debug|x64.ActiveCfg = Debug|x64 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Debug|x64.Build.0 = Debug|x64 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Debug|x86.ActiveCfg = Debug|Win32 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Debug|x86.Build.0 = Debug|Win32 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Release|x64.ActiveCfg = Release|x64 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Release|x64.Build.0 = Release|x64 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Release|x86.ActiveCfg = Release|Win32 + {6524BD24-56A7-42CC-BEAE-8BFDA5B9AC6F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B09196DC-33AB-4ABE-BB84-1CE385F09388} + EndGlobalSection +EndGlobal diff --git a/hex2decimal.vcxproj b/hex2decimal.vcxproj new file mode 100644 index 0000000..8e4a0d8 --- /dev/null +++ b/hex2decimal.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {6524bd24-56a7-42cc-beae-8bfda5b9ac6f} + hex2decimal + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/hex2decimal.vcxproj.filters b/hex2decimal.vcxproj.filters new file mode 100644 index 0000000..5896f12 --- /dev/null +++ b/hex2decimal.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file