VC++6.0代码编制举例分析

这篇文章主要讲解了“VC++6.0代码编制举例分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“VC++6.0代码编制举例分析”吧!

我们提供的服务有:网站设计、网站建设、微信公众号开发、网站优化、网站认证、新和ssl等。为上千多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的新和网站制作公司

VC++6.0代码如下:

public:     void addcity(int city);   int tabu[iCityCount];   void Clear();   void UpdateResult();   double m_dLength;   double m_dShortest;   void move();   ant();   void move2last();    };  void ant::move2last()  {     int i;   for(i=0;i《iCityCount;i++)     if (AllowedCity[i]==1)    {     addcity(i);     break;    }    }    void ant::Clear()  {   m_dLength=0;   int i;   for(i=0; i〈iCityCount;i++)     prob[i]=0;    AllowedCity[i]=1;   }   i=tabu[iCityCount-1];   m_iCityCount=0;   addcity(i);  }  ant::ant()  {   m_dLength=m_dShortest=0;   m_iCityCount=0;   int i;   for(i=0;i〈iCityCount;i++)     AllowedCity[i]=1;    prob[i]=0;   }  }  void ant::addcity(int city)  {   //add city to tabu;   tabu[m_iCityCount]=city;   m_iCityCount++;   AllowedCity[city]=0;  }  int ant::ChooseNextCity()  {   //Update the probability of path selection   //select a path from tabu[m_iCityCount-1] to next     int i;   int j=10000;   double temp=0;   int curCity=tabu[m_iCityCount-1];   for (i=0;i〈iCityCount;i++)     if((AllowedCity[i]==1))     {     temp+=pow((1.0/Map.distance[curCity][i]),beta)*pow((Map.m_dTrial[curCity][i]),alpha);    }   }

以上就是VC++6.0代码的举例说明,可以修改循环次数和其他参数。以得到更好的解。使用TSP数据的时候,将前面的一些字符串信息删除,只留下坐标数据。

感谢各位的阅读,以上就是“VC++6.0代码编制举例分析”的内容了,经过本文的学习后,相信大家对VC++6.0代码编制举例分析这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


网页标题:VC++6.0代码编制举例分析
标题链接:http://lszwz.com/article/jeihpj.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款