error C2064: 项不会计算为接受 2 个参数的函数
voidbiggies(vector<string>&words,vector<string>::size_typesz);intmain(){vector<string...
void biggies(vector<string> &words, vector<string>::size_type sz);
int main()
{
vector<string> svec{ "welcom", "to", "beijing", "china", "welcom", "to",
"hefei", "china" };
biggies(svec, 3);
return 0;
}
void biggies(vector<string> &words, vector<string>::size_type sz)
{
sort(words.begin(), words.end());
stable_sort(words.begin(), words.end(), [sz](const string &a){ return a.size() >sz; });
} 展开
int main()
{
vector<string> svec{ "welcom", "to", "beijing", "china", "welcom", "to",
"hefei", "china" };
biggies(svec, 3);
return 0;
}
void biggies(vector<string> &words, vector<string>::size_type sz)
{
sort(words.begin(), words.end());
stable_sort(words.begin(), words.end(), [sz](const string &a){ return a.size() >sz; });
} 展开
展开全部
具体程序如下:
void CalculateObjectValue(void)
{
int i;
long temp1,temp2,temp3;
double x1,x2;
for(i=0;i<POPSIZE;i++)
{
temp1=DecodeChromosome(population[i].chrom,0,LENGTH1);
temp2=DecodeChromosome(population[i].chrom,0,LENGTH2);
x1=4.096*temp1/1023.0-2.048;
x2=4.096*temp2/1023.0-2.048;
temp3=100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)(1-x1);
population[i].value=temp3;
}
}
显示的错误位置是: temp3=100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)(1-x1);
请高手指教,分数不是问题,只要是正确答案,分数你自己说要多少就是多少(我自己所有的最高分哦)long DecodeChromosome(char * string ,int point ,int length)
{
int i;
long decimal=0;
char *pointer;
for(i=0,pointer=string+point;i<length;i++,point++)
{
decimal+=(*pointer-'0')<<(length-1-i);
}
return(decimal);
}
void CalculateObjectValue(void)
{
int i;
long temp1,temp2,temp3;
double x1,x2;
for(i=0;i<POPSIZE;i++)
{
temp1=DecodeChromosome(population[i].chrom,0,LENGTH1);
temp2=DecodeChromosome(population[i].chrom,0,LENGTH2);
x1=4.096*temp1/1023.0-2.048;
x2=4.096*temp2/1023.0-2.048;
temp3=100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)(1-x1);
population[i].value=temp3;
}
}
显示的错误位置是: temp3=100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)(1-x1);
请高手指教,分数不是问题,只要是正确答案,分数你自己说要多少就是多少(我自己所有的最高分哦)long DecodeChromosome(char * string ,int point ,int length)
{
int i;
long decimal=0;
char *pointer;
for(i=0,pointer=string+point;i<length;i++,point++)
{
decimal+=(*pointer-'0')<<(length-1-i);
}
return(decimal);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询