0_0_27749529_19073.cpp:1:1: error: 'import' does not name a type
import java.util.*;
^
0_0_27749529_19073.cpp:2:1: error: 'import' does not name a type
import java.util.Random;
^
0_0_27749529_19073.cpp:3:1: error: 'import' does not name a type
import java.util.LinkedList;
^
0_0_27749529_19073.cpp:4:1: error: 'import' does not name a type
import java.util.Queue;
^
0_0_27749529_19073.cpp:5:1: error: 'import' does not name a type
import java.util.Stack;
^
0_0_27749529_19073.cpp:6:1: error: 'import' does not name a type
import java.util.Scanner;
^
0_0_27749529_19073.cpp:9:9: error: expected ':' before 'int'
public int from;
^
0_0_27749529_19073.cpp:10:9: error: expected ':' before 'int'
public int to;
^
0_0_27749529_19073.cpp:11:9: error: expected ':' before 'int'
public int weight;
^
0_0_27749529_19073.cpp:12:9: error: expected ':' before 'int'
public int next;
^
0_0_27749529_19073.cpp:13:9: error: expected ':' before 'Edge'
public Edge() {}
^
0_0_27749529_19073.cpp:14:9: error: expected ':' before 'Edge'
public Edge(int from,int to,int weight) {
^
0_0_27749529_19073.cpp:19:1: error: expected ';' after class definition
}
^
0_0_27749529_19073.cpp: In constructor 'Edge::Edge(int, int, int)':
0_0_27749529_19073.cpp:15:14: error: request for member 'from' in '(Edge*)this', which is of pointer type 'Edge*' (maybe you meant to use '->' ?)
this.from=from;
^
0_0_27749529_19073.cpp:16:14: error: request for member 'to' in '(Edge*)this', which is of pointer type 'Edge*' (maybe you meant to use '->' ?)
this.to=to;
^
0_0_27749529_19073.cpp:17:14: error: request for member 'weight' in '(Edge*)this', which is of pointer type 'Edge*' (maybe you meant to use '->' ?)
this.weight=weight;
^
0_0_27749529_19073.cpp: At global scope:
0_0_27749529_19073.cpp:22:9: error: expected ':' before 'static'
public static int maxVertex=1000000; //最大顶点数
^
0_0_27749529_19073.cpp:22:30: error: ISO C++ forbids in-class initialization of non-const static member 'Graph::maxVertex'
public static int maxVertex=1000000; //最大顶点数
^
0_0_27749529_19073.cpp:23:9: error: expected ':' before 'static'
public static int maxEdge=1000000; //最大边数
^
0_0_27749529_19073.cpp:23:28: error: ISO C++ forbids in-class initialization of non-const static member 'Graph::maxEdge'
public static int maxEdge=1000000; //最大边数
^
0_0_27749529_19073.cpp:24:9: error: expected ':' before 'static'
public static int vertex; //顶点数
^
0_0_27749529_19073.cpp:25:9: error: expected ':' before 'static'
public static int edge; //边数
^
0_0_27749529_19073.cpp:26:9: error: expected ':' before 'static'
public static int countV; //边的计数器
^
0_0_27749529_19073.cpp:27:9: error: expected ':' before 'static'
public static int G[][];
^
0_0_27749529_19073.cpp:27:24: error: declaration of 'G' as multidimensional array must have bounds for all dimensions except the first
public static int G[][];
^
0_0_27749529_19073.cpp:28:9: error: expected ':' before 'int'
public int fromList[]=new int[maxVertex];
^
0_0_27749529_19073.cpp:29:9: error: expected ':' before 'Edge'
public Edge edgeList[]=new Edge[maxEdge];
^
0_0_27749529_19073.cpp:30:9: error: expected ':' before 'Graph'
public Graph(int vertex,int edge) {
^
0_0_27749529_19073.cpp:49:9: error: expected ':' before 'void'
public void addEdge(int from,int to,int weight) {
^
0_0_27749529_19073.cpp:57:1: error: expected ';' after class definition
}
^
0_0_27749529_19073.cpp:28:41: error: array must be initialized with a brace-enclosed initializer
public int fromList[]=new int[maxVertex];
^
0_0_27749529_19073.cpp:29:41: error: array must be initialized with a brace-enclosed initializer
public Edge edgeList[]=new Edge[maxEdge];
^
0_0_27749529_19073.cpp: In constructor 'Graph::Graph(int, int)':
0_0_27749529_19073.cpp:31:8: error: request for member 'vertex' in '(Graph*)this', which is of pointer type 'Graph*' (maybe you meant to use '->' ?)
this.vertex=vertex;
^
0_0_27749529_19073.cpp:32:8: error: request for member 'edge' in '(Graph*)this', which is of pointer type 'Graph*' (maybe you meant to use '->' ?)
this.edge=edge;
^
0_0_27749529_19073.cpp:35:15: error: no match for 'operator=' (operand types are 'Edge' and 'Edge*')
edgeList[i]=new Edge();
^
0_0_27749529_19073.cpp:35:15: note: candidates are:
0_0_27749529_19073.cpp:8:7: note: Edge& Edge::operator=(const Edge&)
class Edge {
^
0_0_27749529_19073.cpp:8:7: note: no known conversion for argument 1 from 'Edge*' to 'const Edge&'
0_0_27749529_19073.cpp:8:7: note: Edge& Edge::operator=(Edge&&)
0_0_27749529_19073.cpp:8:7: note: no known conversion for argument 1 from 'Edge*' to 'Edge&&'
0_0_27749529_19073.cpp:37:3: error: 'G' was not declared in this scope
G=new int[vertex+1][vertex+1];
^
0_0_27749529_19073.cpp:37:31: error: array size in new-expression must be constant
G=new int[vertex+1][vertex+1];
^
0_0_27749529_19073.cpp:37:31: error: 'vertex' is not a constant expression
0_0_27749529_19073.cpp:45:15: error: no match for 'operator=' (operand types are 'Edge' and 'Edge*')
edgeList[i]=new Edge();
^
0_0_27749529_19073.cpp:45:15: note: candidates are:
0_0_27749529_19073.cpp:8:7: note: Edge& Edge::operator=(const Edge&)
class Edge {
^
0_0_27749529_19073.cpp:8:7: note: no known conversion for argument 1 from 'Edge*' to 'const Edge&'
0_0_27749529_19073.cpp:8:7: note: Edge& Edge::operator=(Edge&&)
0_0_27749529_19073.cpp:8:7: note: no known conversion for argument 1 from 'Edge*' to 'Edge&&'
0_0_27749529_19073.cpp: In member function 'void Graph::addEdge(int, int, int)':
0_0_27749529_19073.cpp:50:3: error: 'G' was not declared in this scope
G[from][to]=1; //说明from节点到to节点有边
^
0_0_27749529_19073.cpp: At global scope:
0_0_27749529_19073.cpp:59:1: error: expected unqualified-id before 'public'
public class JavaTest {
^
|