#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef struct Node{
int data;
struct Node *next;
struct Node *pre;
}Node;
int DoubleLinkedList(Node *List);
int main(){
Node *List=new Node;
List->next=NULL;
List->pre=NULL;
DoubleLinkedList(List);
Node *p;
while(List->next!=NULL){
p=List->next;
cout<<p->data<<endl;
List=p;
}
while(List->pre!=NULL){
cout<<List->data<<endl;
List=List->pre;
}
}
int DoubleLinkedList(Node* List){
ifstream infile("input.txt");
int Temp;
Node *p,*q;
p=List;
while(infile>>Temp){
q=new Node;
q->data=Temp;
p->next=q;
q->pre=p;
q->next=NULL;
p=q;
}
return 0;
}
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef struct Node{
int data;
struct Node *next;
struct Node *pre;
}Node;
int DoubleLinkedList(Node *List);
int main(){
Node *List=new Node;
List->next=NULL;
List->pre=NULL;
DoubleLinkedList(List);
Node *p;
while(List->next!=NULL){
p=List->next;
cout<<p->data<<endl;
List=p;
}
while(List->pre!=NULL){
cout<<List->data<<endl;
List=List->pre;
}
}
int DoubleLinkedList(Node* List){
ifstream infile("input.txt");
int Temp;
Node *p,*q;
p=List;
while(infile>>Temp){
q=new Node;
q->data=Temp;
p->next=q;
q->pre=p;
q->next=NULL;
p=q;
}
return 0;
}