Guest User

Untitled

a guest
Oct 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1.  
  2. void Stud::Merge(ABS_LIB &A, ABS_LIB &B)
  3. {
  4.  
  5. Stud * M1 = dynamic_cast<Stud * > (&A);
  6. Stud * M2 = dynamic_cast<Stud * > (&B);
  7.  
  8.  
  9. int tmp=M1->count;
  10. for (int i=0;i<tmp;i++)
  11. {
  12. strcpy(M[i].name,M1->M[i].name);
  13. strcpy(M[i].topic,M1->M[i].topic);
  14. count++;
  15. }
  16. tmp+=M2->count;
  17. bool is=false;
  18. for (int i=count,j=0;i<tmp;i++,j++)
  19. {
  20. for (int p=0;p<M1->count;p++)
  21. {
  22. if(strcmp(M2->M[j].name,M1->M[p].name)==0)
  23. is=true;
  24. }
  25. if (is==false)
  26. {
  27. strcpy(M[i].name,M2->M[j].name);
  28. strcpy(M[i].topic,M2->M[j].topic);
  29. count++;
  30. }
  31. is=false;
  32. }
  33. }
Add Comment
Please, Sign In to add comment