/*有向无权图*/
1 #include <bits/stdc++.h>
2 using namespace std;
3 typedef struct {
4 vector<char> graph;
5 char a;
6
7 }zx[1000];
8 int main()
9 {
10 zx z;
11 int n,m;
12 cout<<"输入点的数量和边的数量"<<endl;
13 scanf("%d%d",&n,&m);
14 cout<<"输入点的名"<<endl;
15 for(int i=1;i<=n;i++){
16 cin>>z[i].a;
17 }
18 cout<<"输入点的关系"<<endl;
19 char ll,kk;
20 for(int i=1;i<=m;i++){
21 cin>>ll>>kk;
22 for(int i=1;i<=n;i++){
23 if(ll==z[i].a){
24 z[i].graph.push_back(kk);
25 }
26 }
27
28 }
29 cout<<"输出"<<endl;
30
31 for(int i=1;i<=n;i++)
32 {
33 cout<<endl;
34 cout<<z[i].a<<":->";
35 for(vector <char>::iterator j=z[i].graph.begin();j!=z[i].graph.end();j++){
36 cout<<*j<<"->";//暂时未完美输出
37 }}
38
39 return 0;
40 }