我收到此错误消息,我知道这是因为数组中的参数必须是常量,但我不确定如何安排我的 'this-> V; 保持不变。有什么帮助吗?我提供了大部分代码,以便指针变量的功能在整个程序中都很明显。
// A class that represents an undirected graph
class Graph
{
int V; // number of vertices
list<int> *adj; // A dynamic array of adjacency lists
int *in;
public:
// Constructor and destructor
Graph(int V);
~Graph() { delete[] adj; delete[] in; }
// function to add an edge to graph
void addEdge(int v, int w) { adj[v].push_back(w); (in[w])++; }
// Method to check if this graph is Eulerian or not
bool isEulerianCycle();
// Method to check …Run Code Online (Sandbox Code Playgroud)