sandra0309

Untitled

Mar 18th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. class Potpishuvac
  6. { private:
  7. char ime[20];
  8. char prezime[20];
  9. char embg[14];
  10. public:
  11. Potpishuvac () {}
  12. Potpishuvac( char *ime, char *prezime, char *embg)
  13. {
  14. strcpy(this->ime,ime);
  15. strcpy(this->prezime,prezime);
  16. strcpy(this->embg,embg);
  17. }
  18. Potpishuvac(Potpishuvac const &d)
  19. {
  20. strcpy(ime,d.ime); //copy konstruktor
  21. strcpy(prezime,d.prezime);
  22. strcpy(embg,d.embg);
  23. }
  24. char *getEmbg()
  25. {
  26. return this->embg;
  27. }
  28.  
  29. };
  30.  
  31. class Dogovor
  32. {
  33. private:
  34. int brd;
  35. char kategorija[50];
  36. Potpishuvac pot[3];
  37. public:
  38. Dogovor () {}
  39. Dogovor(int brd,char *kategorija,Potpishuvac *pot)
  40. {
  41. this->brd=brd;
  42. strcpy(this->kategorija,kategorija);
  43. this->pot[0]=pot[0];
  44. this->pot[1]=pot[1];
  45. this->pot[2]=pot[2];
  46. }
  47.  
  48. bool proverka()
  49. {
  50. if(strcmp(pot[0].getEmbg(),pot[1].getEmbg())==0)
  51. return true;
  52. else if(strcmp(pot[0].getEmbg(),pot[2].getEmbg())==0)
  53. return true;
  54. else if(strcmp(pot[1].getEmbg(),pot[2].getEmbg())==0)
  55. return true;
  56. else
  57. return false;
  58. }
  59. };
  60.  
  61.  
  62.  
  63.  
  64. int main()
  65. {
  66. char embg[14], ime[20], prezime[20], kategorija[20];
  67. int broj, n;
  68. cin>>n;
  69. for(int i = 0; i < n; i++){
  70. cin >> embg >> ime >> prezime;
  71. Potpishuvac p1(ime, prezime, embg);
  72. cin >> embg >> ime >> prezime;
  73. Potpishuvac p2(ime, prezime, embg);
  74. cin >> embg >> ime >> prezime;
  75. Potpishuvac p3(ime, prezime, embg);
  76. cin >> broj >> kategorija;
  77. Potpishuvac p[3];
  78. p[0] = p1; p[1] = p2; p[2] = p3;
  79. Dogovor d(broj, kategorija, p);
  80. cout<<"Dogovor "<<i+1<<":"<<endl;
  81. if(d.proverka() == true)
  82. cout << "Postojat potpishuvaci so ist EMBG" << endl;
  83. else
  84. cout << "Ne postojat potpishuvaci so ist EMBG" << endl;
  85. }
  86. return 0;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment