⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exportclass.cpp

📁 MFC程序开发参考大全 【明日科技】宋坤 刘锐宁 李伟明 【丛 书 名】 软件工程师典藏 【出 版 社】 人民邮电出版社 本书详细介绍了MFC框架中所有常用类及控件的应用
💻 CPP
字号:
#include "ExportClass.h"
#include "windows.h"//使用了MessageBox函数所以要加入此头文件引用
//最大公约数
int CMath::GetMaxCommDiv(int a,int b)
{
	int x=1;//a,b保存相除后的结果
	int ires;//保存结构
    if(a<b)
	{
		MessageBox(NULL,"a不能小于b","出错",MB_OK);
		return 0;
	}
	if(b==0)
	{
		MessageBox(NULL,"b不能为0","出错",MB_OK);
		return 0;
	}
    while(x!=0)
	{
		x=a%b;
        a=b;
		ires=b;
		b=x;
	}
	return ires;
}
//最小共倍数
int CMath::GetMinCommMul(int a,int b)
{
	int x=1;//a,b保存相除后的结果
	int ires;//保存结果
	int m,n;//存储临时的a,b值
	m=a;n=b;
    if(a<b)
	{
		MessageBox(NULL,"a不能小于b","出错",MB_OK);
		return 0;
	}
	if(a==0)
	{
		MessageBox(NULL,"a不能为0","出错",MB_OK);
		return 0;
	}
	if(b==0)
	{
		MessageBox(NULL,"b不能为0","出错",MB_OK);
		return 0;
	}
	
    while(x!=0)
	{
		x=a%b;
        a=b;
		ires=b;
		b=x;
	}
	ires=(m*n)/(ires);
	return ires;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -