fsout.cpp

来自「关联规则中转换树算法在VC下的实现」· C++ 代码 · 共 77 行

CPP
77
字号
// FSout.cpp: implementation of the FSout class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AssocRule.h"
#include "FSout.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

FSout::FSout(char *filename)
{
	fout = fopen(filename,"wt");
}

FSout::~FSout()
{
	if(fout) fclose(fout);
}

int FSout::isOpen()
{
	if(fout) return 1;
	else return 0;
}

void FSout::printSet(int length, ItemType *iset, int support)
{
	//#ifdef shown
	if (shown)
	{
		for(int i=0; i<length; i++) 
		{
			fprintf(fout, "%d ", f1item[iset[i]]);
		}
		fprintf(fout, "(%d)\n", support);
	}
	totalFIs++;
	//#endif
}

void FSout::printint(int a)
{
	fprintf(fout, "%5d ", a);
}

void FSout::printarray(int length, ItemType *arr)
{
	for(int i=0; i<length; i++) 
		fprintf(fout, "%5d ", arr[i]);

	fprintf(fout,"\n");
}

void FSout::close()
{
	fclose(fout);
}

void FSout::flush()
{
	fflush(fout);
}

void FSout::printstring(char *str)
{
	fprintf(fout, str);
}

⌨️ 快捷键说明

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