王道的书把我搞晕了,我自己整好了
#define _CRT_SECURE_NO_WARNINGS//防止scanf报错
#include <iostream>
struct Node{
int data;
Node* next;
};
typedef Node* List;
//头插法建表
List HeadInsert(List& L) {
Node* s; int x;
L = (Node*)malloc(sizeof(Node));
L->next = NULL;
scanf("%d", &x);
while (x != 9999) {
s = (Node*)malloc(sizeof(Node));
s->data = x;
s->next = NULL;
L->next = s;
scanf("%d", &x);
}
return L;
}
int main()
{
std::cout << "Hello World!\n";
}