mystaticlib.cpp
来自「MFC程序开发参考大全 【明日科技】宋坤 刘锐宁 李伟明 【丛 书 名】」· C++ 代码 · 共 44 行
CPP
44 行
#include "MyStaticLib.h"
//最大公约数
int GetMaxCommDiv(int a,int b)
{
int x=1;//a,b保存相除后的结果
int ires;//保存结构
if(a<b)
return 0;
if(b==0)
return 0;
while(x!=0)
{
x=a%b;
a=b;
ires=b;
b=x;
}
return ires;
}
//最小共倍数
int GetMinCommMul(int a,int b)
{
int x=1;//a,b保存相除后的结果
int ires;//保存结果
int m,n;//存储临时的a,b值
m=a;n=b;
if(a<b)
return 0;
if(a==0)
return 0;
if(b==0)
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 + =
减小字号Ctrl + -
显示快捷键?