Advertisement
Josif_tepe

Untitled

Apr 26th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Student {
  5. private:
  6.     int indeks;
  7.     char ime[50];
  8.     char prezime[50];
  9. public:
  10.     void set_idenks(int i) {
  11.         indeks = i;
  12.     }
  13.     void set_ime(char *c) {
  14.         strcpy(ime, c);
  15.     }
  16.     void set_prezime(char *c) {
  17.         strcpy(prezime, c);
  18.     }
  19.     void print() {
  20.         cout << ime << " " << prezime << " " << indeks << endl;
  21.     }
  22. };
  23. int main() {
  24.    
  25.     Student niza[1];
  26.     niza[0].set_idenks(10);
  27.     niza[0].set_ime("josif");
  28.     niza[0].set_prezime("josif");
  29.     niza[0].print();
  30.    return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement