📄 lwgiter.cpp
字号:
#include <iostream.h>
#include "lwdgph2.h"
#include "lwgiter.h"
void main(void)
{
LinkedWDigraph<int> G(1);
G.Input();
cout << "The graph has " << G.Edges() << " edges." << endl;
G.Output();
// output adjacent vertices
int n = G.Vertices();
LinkedWeightedIterator<int> x;
for (int i = 1; i <= n; i++) {
cout << "The vertices adjacent to vertex "
<< i << " are" << endl;
int v = x.Begin(G,i);
while (v) {
cout << v << " ";
v = x.NextVertex();
}
cout << endl;
}
cin >> G;
cout << "The graph has " << G.Edges() << " edges." << endl;
cout << G << endl;
// output adjacent vertices
n = G.Vertices();
for (int i = 1; i <= n; i++) {
cout << "The vertices adjacent to vertex "
<< i << " are" << endl;
int v = x.Begin(G,i);
while (v) {
cout << v << " ";
v = x.NextVertex();
}
cout << endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -