作业帮 > 综合 > 作业

c++ 3Q仔有向图G中顶点只有编号的信息,如果r到G中的每个顶点都有路经可达,则称顶点r为G的根顶点.编写算法判断有向

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/10/02 10:45:22
c++ 3Q
仔有向图G中顶点只有编号的信息,如果r到G中的每个顶点都有路经可达,则称顶点r为G的根顶点.编写算法判断有向图G是否有根,若有,则显示所有的根顶点.
c++ 3Q仔有向图G中顶点只有编号的信息,如果r到G中的每个顶点都有路经可达,则称顶点r为G的根顶点.编写算法判断有向
#include using namespace std; #include #include struct Book { char bookname[20]; char author[20]; char ISBN[10]; char date[10]; char publisher[50]; }; struct Node { struct Book book; struct Node *next; }; void option(); void select(); Node *head; Node *pt[10]; FILE *fp; //新增 void ADD(Node *head) { Node *p,*s; s = head; coutnext; s->next = p; p->next = NULL; } //初始化 Node *Initial() { Node *head; head = new Node; head->next = NULL; return head; } //查找 int findauthor(const Node *head) { Node *ps; char author[20]; int count = 0; ps = head->next; coutnext; } if(count == 0) cout