Advertisement
Josif_tepe

Untitled

Apr 29th, 2025
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class Student {
  6. private:
  7.     int godini;
  8.     float prosek;
  9.     string ime;
  10.     int broj_na_predmeti;
  11.    
  12. public:
  13.     Student () {}
  14.     Student(int _godini, float _prosek, string _ime, int _broj_na_predmeti) {
  15.         godini = _godini;
  16.         prosek = _prosek;
  17.         ime = _ime;
  18.         broj_na_predmeti = _broj_na_predmeti;
  19.     }
  20.     Student(int godini, float prosek, string ime, int broj_na_predmeti) {
  21.         this->godini = godini;
  22.         this->prosek = prosek;
  23.         this->ime = ime;
  24.         this->broj_na_predmeti = broj_na_predmeti;
  25.     }
  26.  
  27.     void print() {
  28.         cout << ime << " " << prosek << " " << godini << " " << broj_na_predmeti << endl;
  29.     }
  30.    
  31.    
  32.    
  33. };
  34. int main() {
  35.    
  36.     Student s;
  37.     Student s2(22, 9.0, "Petar", 15);
  38.    
  39.     s2.print();
  40.    
  41.     return 0;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement