Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- using namespace std;
- ifstream fin ("prog.in");
- ofstream fout ("prog.out");
- struct nod
- {
- int a;
- nod * u;
- };
- nod * v=new nod;
- nod * pp;
- void creare(nod *prim)
- {
- int nr;
- fin>>nr;
- prim=new nod;
- pp=prim;
- prim->a=nr;
- while(fin>>nr)
- {
- nod * p=new nod;
- p->a=nr;
- prim->u=p;
- prim=p;
- }
- prim->u=NULL;
- }
- void afisare(nod * p)
- {
- while(p!=NULL)
- {
- fout<<p->a<<' ';
- p=p->u;
- }
- }
- int main()
- {
- creare(v);
- afisare(pp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement