fraction.h

来自「用排序方法解决埃及分数问题的Visual C++ 实现」· C头文件 代码 · 共 36 行

H
36
字号
// Fraction.h: interface for the CProperFractionReduce class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FRACTION_H__1AC44A8A_1C4E_4B58_82E5_038674E8C273__INCLUDED_)
#define AFX_FRACTION_H__1AC44A8A_1C4E_4B58_82E5_038674E8C273__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define MAXSIZE 1024

class CProperFractionReduce  
{
public:
	CProperFractionReduce();
	virtual ~CProperFractionReduce();
public:
	int max_div(int x,int y);//最大公约数
	int min_mul(int x,int y);//最小公倍数
	static int compare(const void *first,const void *second);
	int srch_div(int x);
	int calculate(int fractcnt);
	int combnum(int neednum,int begnum,int leftnum);
	int workitout(int x,int y);
private:
	int databuf[MAXSIZE],idxbuf[MAXSIZE];//约数缓冲,索引数缓冲
	int datacnt,idxcnt;//约数个数,索引数个数
	int calnum,calden;//计算用分子,分母
	int bestbuf[MAXSIZE];//最佳组合的约数缓冲区
	int bestcnt;//最佳组合的约数个数
};

#endif // !defined(AFX_FRACTION_H__1AC44A8A_1C4E_4B58_82E5_038674E8C273__INCLUDED_)

⌨️ 快捷键说明

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