Advertisement
Josif_tepe

Untitled

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