->"); outfile<<R[dest][j]<<(R[dest][j]==dest?"\n":"--->"); } else break; }} cout<<" 最短路径长度:"<<RL[dest]<<endl; cout<<"*********************"<<endl; outfile<<" 最短路径长度:"<<RL[dest]<<endl; outfile<<"*********************"<<endl; }} cout<<" 路由表已经存储在当前目录下 Route.txt 文件中"<<endl; outfile.close(); } void deleteMemo(int * weight[],int * R[], int RL[],int num){ // 释放所有动态空间 for(int i=0;i<num;i++){ delete [] weight[i];weight[i]=NULL; delete [] R[i]; R[i]=NULL; } delete [] weight;weight=NULL; delete [] R;R=NULL; delete [] RL;RL=NULL; } int main() // 主程序{ int vNum; cout<<" 请输入拓扑图中节点的数目: "; cin>>vNum; cout<<endl; int ** weight=new int* [vNum]; // 定义拓扑图中的路径的权值 int ** shortestRoute=new int* [vNum];// 记录到达网络中各节点的最短路径 int* routeLen=new int [vNum]; // 最短路径长度 createGraph(weight,vNum); printFileGraph(weight,vNum);