⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 主程序.txt

📁 一、 程序分析 1. 以邻接多重表为存储结构
💻 TXT
字号:
/*主程序*/ 
int main(void)
{ 
  int n; 
  Graph *g=(Graph *)malloc(sizeof(Graph)); 
  char menu; 
  printf("Please input the number of vertex:\n"); 
  scanf("%d",&n); 
  creatgraph(g,n); 
  printf("This is the linjiejuzhen of graph:\n"); 
  printgraph(g); 
  input: 
  printf("Please input b or d or q ,Breadth_first: b  Depth_first: d quit: q\n"); 
  while((menu=getchar())=='\n'); 
  if(menu=='b') 
    { 
      printf("Breadth_first:\n"); 
      BESTraverse(g); 
      printf("\n"); 
      goto input; 
    } 
  else if(menu=='d') 
    { 
      printf("Depth_first:\n"); 
      dfstraverse(g); 
      printf("\n"); 
      goto input; 
    } 
  else if(menu=='q') 
    { 
     exit(0); 
    } 
  else 
    { 
      printf("Input error!Please input b or d!\n"); 
    } 
 /* 此处添加你自己的代码 */
  getch();
  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -