Advertisement
Guest User

Untitled

a guest
May 25th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream f("date.in");
  5. struct nod
  6. {
  7. char info;
  8. nod *urm;
  9. };
  10. nod *p;
  11. void add(nod *&p, char x)
  12. {
  13. if(x)
  14. {
  15. nod *c=new nod;
  16. c->info=x;
  17. c->urm=p;
  18. p=c;
  19. }
  20. }
  21. void aff(nod *p)
  22. {
  23. while(p)
  24. {
  25. cout<<p->info<<" ";
  26. p=p->urm;
  27. }
  28. }
  29.  
  30.  
  31.  
  32. int main()
  33. {
  34. char x;
  35. f>>x;
  36. while(x!='0')
  37. {
  38. add(p,x);
  39. f>>x;
  40.  
  41. }
  42. aff(p);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement