Seeking precision function

本文介绍了一种计算从一系列相似值中获取精度值的方法。通过对比输入文件名与记录中的相似值来确定匹配度,并据此计算出精度。该过程涉及文件读取、字符串比较等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/*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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值