#include <stdio.h>
#include <stdlib.h>
#define FALSE 0
#define TRUE 1
typedef struct node_data
{
int id;
char name[20];
char phone [20];
char address[20];
char tel[20];
}NodeData;
typedef struct _node
{
NodeData bug;
struct _node * next;
}Node;
void menu(Node *s)
{
printf ("添加好友\n");
printf ("显示好友\n");
}
//添加好友
void newfriend (Node *s)
{
Node *node = (Node*)malloc(sizeof(Node)/sizeof(char));
if (node == NULL)
return ;
system("clear");
node->next = NULL;
printf ("请输入好友id\n");
scanf ("%d" ,&(node->bug.id));
printf ("请输入好友姓名\n");
scanf ("%s" ,node->bug.name);
printf ("请输入好友电话号码\n");
scanf ("%s" ,node->bug.phone);
printf ("请输入好友家庭住址\n");
scanf ("%s" ,node->bug.address);
printf ("请输入好友公司号码\n");
scanf ("%s" ,node->bug.tel);
Node *tmp = s;
while (tmp->next)
{
tmp = tmp->next;
}
tmp->next = node;
}
//显示好友
//先求长度
void LookFriend (Node*s)
{
system("clear");
int count = 0;
Node *tmp = s;
while (tmp->next)
{
tmp = tmp->next;
count ++;
}
//排序
#include <stdlib.h>
#define FALSE 0
#define TRUE 1
typedef struct node_data
{
int id;
char name[20];
char phone [20];
char address[20];
char tel[20];
}NodeData;
typedef struct _node
{
NodeData bug;
struct _node * next;
}Node;
void menu(Node *s)
{
printf ("添加好友\n");
printf ("显示好友\n");
}
//添加好友
void newfriend (Node *s)
{
Node *node = (Node*)malloc(sizeof(Node)/sizeof(char));
if (node == NULL)
return ;
system("clear");
node->next = NULL;
printf ("请输入好友id\n");
scanf ("%d" ,&(node->bug.id));
printf ("请输入好友姓名\n");
scanf ("%s" ,node->bug.name);
printf ("请输入好友电话号码\n");
scanf ("%s" ,node->bug.phone);
printf ("请输入好友家庭住址\n");
scanf ("%s" ,node->bug.address);
printf ("请输入好友公司号码\n");
scanf ("%s" ,node->bug.tel);
Node *tmp = s;
while (tmp->next)
{
tmp = tmp->next;
}
tmp->next = node;
}
//显示好友
//先求长度
void LookFriend (Node*s)
{
system("clear");
int count = 0;
Node *tmp = s;
while (tmp->next)
{
tmp = tmp->next;
count ++;
}
//排序