Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Student {
- private:
- int *niza;
- int br_predmeti;
- public:
- Student() {}
- Student(int *a, int n) {
- niza = new int[n];
- br_predmeti = n;
- for(int i = 0; i < n; i++) {
- niza[i] = a[i];
- }
- }
- ~Student() {
- }
- void pecati() {
- for(int i = 0; i < br_predmeti; i++) {
- cout << niza[i] << " ";
- }
- cout << endl;
- }
- };
- int main()
- {
- int n;
- cin >> n;
- int niza[n];
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- Student s(niza, n);
- s.pecati();
- int nov_n;
- cin >> nov_n;
- int nova_niza[nov_n];
- for(int i = 0; i < nov_n; i++) {
- cin >> nova_niza[i];
- }
- s = Student(nova_niza, nov_n);
- s.pecati();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement