Find out why this program is not working which converts list representation of graph in adjacency matrix #include<iostream> using namespace std;
struct node { node* point; node* next; int info; }; node * getnode(int i); void adja(int count,node **p); int main() { int count,wt,j,i; node *r1,*r2; char c='y'; cout<<"Enter the no. of nodes"; cin>>count; node * root[50]; for(i=0;i<count;++i) { root[i]=getnode(i); if(i!=0) root[i-1]->next=root[i]; } for(i=0;i<count;++i) { c='y'; r2=root[i]; while(c=='y') { cout<<"Enter the node connected to "<<i+1<<" th node :"; cin>>j; cout<<"Enter the weight"; cin>>wt; if(r2==root[i]) { r2->point=getnode(wt); r2=r2->point; r2->point=root[j-1]; r2->info=wt; } else { r2->next=getnode(wt); r2=r2->next; r2->point=root[j-1]; r2->info=wt; } cout<<"Enter y for more node else n :-"; cin>>c; } } adja(count,&root[0]); } node * getnode(int i) { node * s=new node; s->info=i; s->next=NULL; s->point=NULL; return s; } void adja(int count,node **p) { node *k; int adj[50][50],i,flag,j; cout<<"er"; for(i=0;i<count;++i) for(j=0;j<count;j++) adj[i][j]=0; for(i=0;i<count;++i) { cout<<"rr"; k=*(p+i); while(k!=NULL) { flag=0; if(flag==0) { k=k->point; adj[i][k->info]=k->info; flag=1; } else { k=k->next; adj[i][k->info]=k->info; } } } for(i=0;i<count;++i) { for(j=0;j<count;j++) cout<<adj[i][j]<<"\t"; cout<<"\n"; } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---