From af9587bd14fe2e56d30b8367d1a7ee24328c102a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=A5=E5=B1=B1?= <1760264627@qq.com> Date: Wed, 2 Dec 2020 14:02:52 +0800 Subject: [PATCH] 12.1 --- chu/chu.cpp | 14 +++++++ chu/chu.h | 7 ++++ chu/chu.vcxproj | 91 +++++++++++++++++++++++++++++++++++++++++ chu/chu.vcxproj.filters | 30 ++++++++++++++ chu/main.cpp | 50 ++++++++++++++++++++++ 5 files changed, 192 insertions(+) create mode 100644 chu/chu.cpp create mode 100644 chu/chu.h create mode 100644 chu/chu.vcxproj create mode 100644 chu/chu.vcxproj.filters create mode 100644 chu/main.cpp diff --git a/chu/chu.cpp b/chu/chu.cpp new file mode 100644 index 0000000..4270af7 --- /dev/null +++ b/chu/chu.cpp @@ -0,0 +1,14 @@ +#include "chu.h" + + +int chu(int a, int b) +{ + if (0 != b) + { + return a / b; + } + else + { + return 0; + } +} diff --git a/chu/chu.h b/chu/chu.h new file mode 100644 index 0000000..c2d7d0e --- /dev/null +++ b/chu/chu.h @@ -0,0 +1,7 @@ +#ifndef DIV_H +#define DIV_H + +int chu(int a, int b); + + +#endif \ No newline at end of file diff --git a/chu/chu.vcxproj b/chu/chu.vcxproj new file mode 100644 index 0000000..0055aec --- /dev/null +++ b/chu/chu.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {1A262FA8-268E-4CDD-8411-9C91E928BB6C} + Win32Proj + chu + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_DLLAPI;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + + + Console + true + ..\Debug;%(AdditionalLibraryDirectories) + ..\Debug\jia.lib;..\Debug\jian.lib;..\Debug\chen.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/chu/chu.vcxproj.filters b/chu/chu.vcxproj.filters new file mode 100644 index 0000000..c0c538b --- /dev/null +++ b/chu/chu.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;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 diff --git a/chu/main.cpp b/chu/main.cpp new file mode 100644 index 0000000..d202195 --- /dev/null +++ b/chu/main.cpp @@ -0,0 +1,50 @@ +#include +#include "../jia/jia.h" +//#pragma comment(lib,"jia.lib") +#include "../jian/jian.h" +//#pragma comment(lib,"jian.lib") +#include "chu.h" +#include "Windows.h" +#include "../chen/chen.h" + +typedef int(*PMUL)(int a, int b); +typedef bool(*QCHEN)(int a, int b,int *e); +int main() +{ + + int a, b; + int c = 0; + int d = 0; + int e = 0; + + printf("\n"); + scanf("%d%d", &a, &b); + + bool ret1 = Add(a, b, &c); + printf("ret1=%d a+b=%d\n",ret1,c); + + + bool ret2 = Sub(a, b, &d); + printf("ret2=%d a-b=%d\n", ret2,d); + + HMODULE hDLL = LoadLibrary(L"../Debug/chen.dll"); + if (hDLL == NULL) + { + printf("DLLļʧ\n"); + return 0; + + } + PMUL pMul = (PMUL)GetProcAddress(hDLL, "mul"); + QCHEN qChen = (QCHEN)GetProcAddress(hDLL, "chen"); + + bool ret3 = chen(a, b, &e); + printf("ret3=%d a*b=%d\n", ret3, e); + + + printf("a/b=%d\n", chu(a, b)); + + FreeLibrary(hDLL); + + + +} \ No newline at end of file