Advertisement
Josif_tepe

Untitled

Mar 24th, 2021
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Student {
  6. private:
  7.     char ime[50];
  8.     char prezime[52];
  9. public:
  10.     Student(const char* i = "", const char  *p = "") {
  11.         strcpy(ime, i);
  12.         strcpy(prezime, p);
  13.     }
  14.     ~Student() {
  15.        
  16.     }
  17.     friend class Student_na_smer_KTI;
  18.     friend void pecati(Student s);
  19. };
  20. class Student_na_smer_KTI {
  21. private:
  22.     Student s;
  23.     double prosek;
  24. public:
  25.     Student_na_smer_KTI(Student _s, double p) {
  26.         s = _s;
  27.         prosek = p;
  28.     }
  29.     const char* get_ime() const {
  30.         return s.ime;
  31.     }
  32. };
  33. void pecati(Student s) {
  34.     cout << s.ime << " " << s.prezime << endl;
  35. }
  36. int main() {
  37.     Student s("finki", "finki");
  38.     Student_na_smer_KTI t(s, 10.0);
  39.     pecati(s);
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement