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

发布时间:2021-11-29 16:42:03 作者:iii
来源:亿速云 阅读:176

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

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代码编制举例分析这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

推荐阅读:
  1. Solidity基本代码举例分析
  2. Python命令行代码举例分析

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

c++

上一篇:如何搭建C++开发环境

下一篇:C/C++ Qt TreeWidget单层树形组件怎么应用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》