一些比较简单的和实验的没有在这里给出。 #include "stdio.h" #include "stdlib.h" #include "time.h" #define cityNum 10 #define popSize 10 #define croRate 0.85 #define mutRate 0.1 #define MAX 999 //定义染色体的结构 struct Chrom { int cityArr[cityNum]; char name; float adapt; int dis; }; struct Chrom genes[popSize]; struct Chrom genesNew[popSize]; struct Chrom temp; char names[cityNum] = {'A','B','C','D','E','F','G','H','I','J'}; int distance[cityNum][cityNum] = {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 0, 1, 2, 3, 4, 5, 6, 7,...