Advertisement
Guest User

Untitled

a guest
Jun 26th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. /*
  2. * Bilet 3
  3. **********************/
  4.  
  5. #include<iostream> //teste
  6. #include<fstream>
  7. #include<string>
  8. using namespace std;
  9.  
  10. class data{
  11. private:
  12. int z,l,a;
  13. string k;
  14. public:
  15. void init( ifstream &f ){ f>>z;}
  16. };
  17.  
  18. class elev{
  19. private:
  20. int nr_mat;
  21. int an; //and de studii
  22. int grupa;
  23. string nume;
  24. string fac; //facultatea
  25. data *nascut;
  26. public:
  27. /* Format intrare : nr_matricol nume data_nasterii(z l an) facultatea and_de_studiu grupa */
  28. void init( ifstream &f ){ f>>nr_mat>>nume; nascut -> init(f); f>>fac>>an>>grupa; }
  29. };
  30.  
  31. /* Lista Simplu Inlantuita */
  32. class lsi{
  33. public :
  34. elev e;
  35. lsi *urm;
  36. };
  37.  
  38. void cit(ifstream &f, lsi *&start){
  39. lsi *c=new lsi, *j;
  40. while(!f.eof()){
  41. (c->e).init(f);
  42. c->urm=0;
  43. if(!start)
  44. start=c;
  45. else{
  46. for(j=start; j->urm; j=j->urm);
  47. j->urm=c;
  48. }
  49. }
  50. }
  51.  
  52. void sub1a(lsi *&start1, lsi *&start2){
  53. lsi *c=new lsi,*j;
  54. ifstream fin1("elevi1.in");
  55. ifstream fin2("elevi2.in");
  56.  
  57. cit(fin1, start1);
  58. cit(fin2, start2);
  59. }
  60.  
  61.  
  62. int main(){
  63. lsi *start1, *start2;
  64. start1=start2=0;
  65.  
  66. sub1a(start1, start2);
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement