实现基本初始化、插入、删除、遍历操作。
#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
#define MAX 100
#define OK 1
#define ERROR 0
typedef int status;
typedef struct
{
int C;
int Math;
}Score;
typedef struct
{
char name[20];
char ID[20];
Score sc;
}Student;
typedef struct node
{
Student std;
struct node* next;
}Node,LinkedList;
status Initial(LinkedList* & head)
{
head = new LinkedList;
if (!head)
return ERROR;
head->next = NULL;
return OK;
}
status Insert(LinkedList*& head, Student std)
{
Node* p = new Node;
if (!p)
return ERROR;
p->std = std;
p->next = NULL;