Advertisement
edutedu

liste

Oct 6th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct Nod {
  6. char nume [20];
  7. int h;
  8. Nod* leg;
  9. }*prim, *ultim, *p, *e[20];
  10.  
  11. int main()
  12. {
  13. int n, i, j=1;
  14. cin>>n;
  15. e[20]=new Nod;
  16. prim=new Nod;
  17. ultim=new Nod;
  18. p=new Nod;
  19. for(i=1; i<=n; i++);
  20. {
  21. cout<<"Introduceti numele elevului: "<<endl; cin>>e[i]->nume;
  22. cout<<"Introduceti inaltimea elevului: "<<endl; cin>>e[i]->h;
  23. if(i!=n)
  24. e[i]->leg=e[i+1];
  25. else
  26. e[i]->leg=NULL;
  27. }
  28.  
  29. while(e[j]!=NULL)
  30. {
  31. cout<<e[j]->nume<<" "<<p[j]->h<<" ";
  32. e[j]=e[j]->leg;
  33. j++;
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement