C++问题:local function definitions are illegal和unexpected end of file found

来源:百度知道 编辑:UC知道 时间:2024/06/17 15:51:13
#include"stdio.h"
#include"stdlib.h"
#define MAX 20
#define NULL 0
struct ArcNode
{int adjvex;
struct ArcNode *nextarc;
};
struct Vnode
{int data;
struct ArcNode *firstarc;
};
struct Vnode AdjList[MAX];
void CreatGraph(struct Vnode A[MAX]);
void DFS(struct Vnode A[MAX]);
void BFS(struct Vnode A[MAX]);
int m,n,v,cord;
void main()
{
do{
printf("\n 主菜单");
printf("\n 1 建立无向图的邻接链表");
printf("\n 2 按深度遍历图");
printf("\n 3 按广度遍历图");
printf("\n 4 结束程序运行");
printf("\n===============================");
printf("\n 请输入您的选择(1,2,3,4)");
scanf("%d",&cord);
switch(cord)
{case 1:CreatGraph(AdjList);break;
case 2:DFS(AdjList);break;
case 3:BFS(AdjList);break;

#include"stdio.h"
#include"stdlib.h"
#define MAX 20
#define NULL 0
struct ArcNode
{int adjvex;
struct ArcNode *nextarc;
};
struct Vnode
{int data;
struct ArcNode *firstarc;
};
struct Vnode AdjList[MAX];
void CreatGraph(struct Vnode A[MAX]);
void DFS(struct Vnode A[MAX]);
void BFS(struct Vnode A[MAX]);
int m,n,v,cord;
void main()
{
do{
printf("\n 主菜单");
printf("\n 1 建立无向图的邻接链表");
printf("\n 2 按深度遍历图");
printf("\n 3 按广度遍历图");
printf("\n 4 结束程序运行");
printf("\n===============================");
printf("\n 请输入您的选择(1,2,3,4)");
scanf("%d",&cord);
switch(cord)
{case 1:CreatGraph(AdjList);break;
case 2:DFS(AdjList);break;
case 3:BFS(AdjList);break;
case 4:exit(0);