Seeking precision function

来源:互联网 发布:睿博数据招聘 编辑:程序博客网 时间:2024/06/11 15:27

/*The destination of following code is to compute the precision value from the result of sequential similar values. 

   welcome you to submit some good methods or codes and communicate with each other.*/

float getPreValue(float* str2,float* d,int want)

{
float pre=0; //根据相似度获取文件名称
char ccur[20]={0};
for (int i=0;i<14;i++)
{
ccur[i]=inputFilename[i];
}
ifstream ifs01(cur01,ios::in|ios::out|ios::app);
char p[40]={0};
char buffer[20]={NULL};
for (int i=0;i<want;i++)
{
for (int jj=0;jj<j;jj++)
{
if (str2[i]==d[jj])
{
for (int jc=0;jc<=jj;jc++)
{
ifs01.getline(p,40,'\n');
}
int len=strlen(p);
int le=strlen(ccur);
for (int k=0;k<le;k++)
{
buffer[k]=p[k];
}


if (!strcmp(ccur,buffer))
{
++pre;
}
}
}
ifs01.seekg(0);
}
ifs01.close();
float prec=pre/want;
cout<<"precision is "<<prec<<endl;
return prec;
}
0 0
原创粉丝点击