#include<iostream> #include<fstream> #include<cstdio> #include<cmath> #include<string> #include<cstring> #include<string.h> #include<algorithm> #include <cstdlib> using namespace std; struct node { int data; struct node *next; }; void allOut(struct node *input){ while(input != nullptr){ cout << input->data << endl; input = input->next; } } struct node *tem; void putInEnd(struct node *input,int inputData){ while(true){ input = input->next; if(input->next == nullptr){ break; } } tem = (struct node *)malloc(sizeof(struct node)); tem->data = inputData; tem->next = nullptr; input->next = tem; } int main(){ struct node *head,*p,*q; head = nullptr; int n; cin >> n; int tem; for(int i = 0;i < n;i++){ p = (struct node
数据结构P3.单链表在最后插入数据
最新推荐文章于 2024-07-23 12:29:02 发布