简单链表输入输出:
#include <iostream> #include <cstdio> using namespace std; int a[100]; struct poi{ int now; poi *next; }; int main() { poi *start; poi *now; now=NULL; start=now; int i=0; poi *noww; while (++i<=10) { noww=new poi; noww->next=now; start=noww; now=noww; scanf("%d",&now->now); } printf("%d ",start->now); now=start; while (now!=NULL) { printf("%d ",now->now); now=now->next; } }