Advertisement
Lempek

klasy.cpp

Dec 27th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. #include "klasy.h"
  2. #include "funkcje.h"
  3. // Metody klasy osoba
  4.  
  5. // Konstruktor domyślny
  6.  
  7. Osoba::Osoba() {
  8. }
  9. // Konstruktor z parametrami
  10.  
  11. Osoba::Osoba(string &im, string &nazw) {
  12. imie = im;
  13. nazwisko = nazw;
  14. }
  15. // Konstruktor kopiujący
  16.  
  17. Osoba::Osoba(const Osoba &osoba) {
  18. imie = osoba.imie;
  19. nazwisko = osoba.nazwisko;
  20. }
  21.  
  22. // Destruktor
  23. Osoba::~Osoba(){
  24.  
  25. }
  26. // Metody do wyświetlania danych
  27.  
  28. void Osoba::wyswietl() {
  29. cout << right << setw(12) << imie << setw(15) << nazwisko << endl;
  30. }
  31.  
  32. void Osoba::wyswietl_nvirt() {
  33. cout << right << setw(12) << imie << setw(15) << nazwisko << endl;
  34. }
  35.  
  36.  
  37. // Metody klasy student
  38.  
  39. // Konstruktor domyślny
  40.  
  41. Student::Student() {
  42. }
  43. // Konstruktor z paramterami
  44.  
  45. Student::Student(string &im, string &nazw, float &sred, string &kier, int &nr_sem, int &nr_ind) {
  46. imie = im;
  47. nazwisko = nazw;
  48. srednia = sred;
  49. kierunek = kier;
  50. nr_semestru = nr_sem;
  51. nr_indeksu = nr_ind;
  52. }
  53. // Konstruktor kopiujący
  54.  
  55. Student::Student(const Student &student) {
  56. imie = student.imie;
  57. nazwisko = student.nazwisko;
  58. srednia = student.srednia;
  59. kierunek = student.kierunek;
  60. nr_semestru = student.nr_semestru;
  61. nr_indeksu = student.nr_indeksu;
  62. }
  63. // Destruktor
  64. Student::~Student(){
  65.  
  66. }
  67. // Funkcje służące do wyświetlania danych w konsoli
  68.  
  69. void Student::wyswietl() {
  70. cout << right << setw(12) << imie << setw(15) << nazwisko << setw(14) << nr_indeksu
  71. << setw(10) << kierunek << setw(10) << nr_semestru << setw(13) << fixed << setprecision(2) << srednia << "\n";
  72. }
  73.  
  74. // Metody klasy pracownik
  75. // Konstruktor domyślny
  76.  
  77. Pracownik::Pracownik() {
  78. }
  79. // Konstruktor z parametrami
  80.  
  81. Pracownik::Pracownik(string &im, string &nazw, float &pen) {
  82. imie = im;
  83. nazwisko = nazw;
  84. pensja = pen;
  85. }
  86. // Konstruktor kopiujący
  87.  
  88. Pracownik::Pracownik(const Pracownik &pracownik) {
  89. imie = pracownik.imie;
  90. nazwisko = pracownik.nazwisko;
  91. pensja = pracownik.pensja;
  92. }
  93. // Destruktor
  94. Pracownik::~Pracownik(){
  95.  
  96. }
  97. // Funkcje do zapisywania i wczytywania danych z/do pliku oraz wyświetlania danych w konsoli
  98.  
  99. void Pracownik::wyswietl() {
  100. cout << right << setw(12) << imie << setw(15) << nazwisko << setw(14) << pensja << "\n";
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement