Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- struct nod{
- int info;
- nod *leg;
- };
- nod *creare (){
- nod *prim, *p, *q;
- ifstream f ("date.in");
- prim = new nod;
- f>>prim->info;
- q=prim;
- while (f.good()){
- p = new nod;
- f>>p->info;
- q->leg=p;
- q=p;
- }
- p->leg=NULL;
- return prim;
- }
- void afisare (nod *prim){
- nod *p = new nod;
- p=prim;
- while (p){
- cout<<p->info<<endl;
- p=p->leg;
- }
- }
- int main()
- {
- afisare(creare());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement