int main(){
for(int k=0;k<m;k++){
AddEdge(graph,rand()%n,rand()%n);
}
}
void AddEdge(Graph *graph,int v1, int v2)//加邊
{
ofstream ocout;
ocout.open("city.txt");
if (v1 == v2){
cout<<"冗余邊"<<v1<<" "<<v2<<endl;
ocout<<"冗余邊"<<v1<<" "<<v2<<endl;
return;
}
}
應該怎麼改啊,還沒學文件
ofstream ocout;
void AddEdge(int v1, int v2)//加邊
{
ocout.seekp(0, ios_base::end);
cout<<"冗余邊"<<v1<<" "<<v2<<endl;
ocout<<"冗余邊"<<v1<<" "<<v2<<endl;
}
int main()
{
ocout.open("city.txt");
for(int k=0;k<10;k++)
{
AddEdge(rand()%5,rand()%5);
}
ocout.close();
}