-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLINK.C
54 lines (52 loc) · 1.04 KB
/
LINK.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct list{
char name[40];
long int phone;
struct list *next;
};
typedef struct list node;
void main()
{
node *origin;
node *disply;
char choice;
origin=(node *)malloc(sizeof(node));
disply=origin;
clrscr();
while(1)
{
printf("\n\tenter the name ");
fflush(stdin);
gets(origin->name);
printf("\n\tenter the phone number ");
fflush(stdin);
scanf("%ld",&origin->phone);
printf("\n\tNAME : %s ",origin->name);
printf("\n\tPHONE : %ld ",origin->phone);
printf("\n\n\t\tmore...y/n");
fflush(stdin);
choice=getchar();
if(toupper(choice)=='N')
{
origin->next=0;
break;
}
origin->next=(node *)malloc(sizeof(node));
origin=origin->next;
clrscr();
}
getch();
while(1)
{
clrscr();
printf("\n\tNAME : %s ",disply->name);
printf("\n\tPHONE : %ld ",disply->phone);
getch();
if(disply->next==NULL)
exit(0);
disply=disply->next;
fflush(stdin);
}
}