Get the App
SLTechnology News&Howtos  ›  Development  › 

An example Analysis of VC++6.0 Code programming

Shulou Source: shulou.com Published: 2022-06-02 09:42:30 10月16日 Update

This article mainly explains "VC++6.0 code compilation example analysis". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "VC++6.0 code compilation example analysis" together.

VC++6.0 code is as follows:

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); } }

The above is an example of VC++6.0 code, you can modify the number of cycles and other parameters. To get a better solution. When using TSP data, delete some of the previous string information, leaving only coordinate data.

Thank you for reading, the above is the "VC++6.0 code preparation example analysis" content, after the study of this article, I believe that we have a deeper understanding of VC++6.0 code preparation example analysis this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Code compilation analysis learning content that is data information parameters coordinates characters strings ideas situations articles times more times knowledge knowledge points Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Docker MariaDB vpn MySQL