#include<stdio.h>
#include<conio.h>
struct adj_node
{
char nam;
struct adj_node *adj_next;
};
struct node
{
char name;
struct adj_node *down;
struct node *next;
};
struct node * gins(struct node *);
struct node * lins(struct node *);
main()
{
int n,i,j;
char c,r;
struct node *g,*t;
g=malloc(sizeof(struct node));
g->next=NULL;
g=gins(g);
g=lins(g);
getch();
}
struct node * gins(struct node *a)
{
char c;
do
{
printf("n enter vertex else a spacen");
scanf("%c",&c);
fflush(stdin);
if(c!=' ')
{
a=a->next;
a=malloc(sizeof(struct node));
a->name=c;
a->next=NULL;
}
}while(c!=' ');
return a;
}
struct node * lins(struct node *a)
{
char c;
do
{
a=a->next;
do
{
printf("n is there any edge incedented on vertex %c Y or N n",a->name);
scanf("%c",&c);
fflush(stdin);
if(c=='Y')
{
a->down=malloc(sizeof(struct adj_node));
printf("n enter the other vertex of the edge incedented on %cn ",a->name);
scanf("%c",&a->down->nam);
fflush(stdin);
a->down->adj_next=NULL;
a->down=a->down->adj_next;
}
else
{
a->down=NULL;
}
}while(c!='N');
a=a->next;
}while(a->next!=NULL);
return a;
}
optimus_prime_1 -6 Newbie Poster
optimus_prime_1 -6 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
optimus_prime_1 -6 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
optimus_prime_1 -6 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
optimus_prime_1 -6 Newbie Poster
deceptikon commented: Maybe it's a language barrier, but lots of rude and presumptuous remarks in this post. -2
optimus_prime_1 -6 Newbie Poster
optimus_prime_1 -6 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.