Advertisement
Josif_tepe

Untitled

May 11th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <cmath>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. struct Student {
  8.     int br_indeks;
  9.     int godina_na_raganje;
  10.     string ime, prezime;
  11.    
  12.     Student() {}
  13.     Student(int _br_indeks, int _godina_na_raganje, string _ime, string _prezime) {
  14.         br_indeks = _br_indeks;
  15.         godina_na_raganje = _godina_na_raganje;
  16.         ime = _ime;
  17.         prezime = _prezime;
  18.     }
  19.     friend ostream& operator << (ostream &stream, Student s);
  20. };
  21.  ostream& operator << (ostream &stream, Student s) {
  22.     stream << s.ime << " " << s.prezime << " " << s.br_indeks << " "<< s.godina_na_raganje << endl;
  23.     return stream;
  24. }
  25. int main() {
  26.     Student s(123, 2001, "josif", "tepegjozov");
  27.     cout << s;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement