From a0ef46658cd685ebcd41ede650966107c218ea29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=A5=E5=B1=B1?= <1760264627@qq.com> Date: Mon, 7 Dec 2020 17:02:40 +0800 Subject: [PATCH] 44 --- jia/chu/chu.cpp | 14 ++++++ jia/chu/chu.h | 7 +++ jia/chu/chu.vcxproj | 91 +++++++++++++++++++++++++++++++++++++ jia/chu/chu.vcxproj.filters | 30 ++++++++++++ jia/chu/main.cpp | 50 ++++++++++++++++++++ 5 files changed, 192 insertions(+) create mode 100644 jia/chu/chu.cpp create mode 100644 jia/chu/chu.h create mode 100644 jia/chu/chu.vcxproj create mode 100644 jia/chu/chu.vcxproj.filters create mode 100644 jia/chu/main.cpp diff --git a/jia/chu/chu.cpp b/jia/chu/chu.cpp new file mode 100644 index 0000000..df261e2 --- /dev/null +++ b/jia/chu/chu.cpp @@ -0,0 +1,14 @@ +#include "chu.h" + + +int chu(int a, int b) +{ + if (b != 0) + { + return a / b; + } + else + { + return 0; + } +} diff --git a/jia/chu/chu.h b/jia/chu/chu.h new file mode 100644 index 0000000..c2d7d0e --- /dev/null +++ b/jia/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/jia/chu/chu.vcxproj b/jia/chu/chu.vcxproj new file mode 100644 index 0000000..0055aec --- /dev/null +++ b/jia/chu/chu.vcxproj @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1A262FA8-268E-4CDD-8411-9C91E928BB6C}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>chu</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_DLLAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalLibraryDirectories>..\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>..\Debug\jia.lib;..\Debug\jian.lib;..\Debug\chen.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="chu.cpp" /> + <ClCompile Include="main.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="chu.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/jia/chu/chu.vcxproj.filters b/jia/chu/chu.vcxproj.filters new file mode 100644 index 0000000..c0c538b --- /dev/null +++ b/jia/chu/chu.vcxproj.filters @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="源文件"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="头文件"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="资源文件"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="main.cpp"> + <Filter>源文件</Filter> + </ClCompile> + <ClCompile Include="chu.cpp"> + <Filter>源文件</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="chu.h"> + <Filter>头文件</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/jia/chu/main.cpp b/jia/chu/main.cpp new file mode 100644 index 0000000..4116f96 --- /dev/null +++ b/jia/chu/main.cpp @@ -0,0 +1,50 @@ +#include <stdio.h> +#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