Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class node {
- static node *head;
- node* next;
- char *interpret, *melodie;
- public:
- node (char* = nullptr, char* = nullptr);
- void display_all ();
- void citireAlbum ();
- };
- int n, index;
- char s[100], t[100];
- node* p;
- node* node::head = nullptr;
- node::node (char* ptr, char* ptr1) {
- next = nullptr, interpret = ptr, melodie = ptr1;
- }
- inline void node::display_all () {
- for (node* curr = head; curr; curr = curr->next)
- std::cout << "(" << curr->interpret << ", " << curr->melodie << ") ";
- }
- inline void node::citireAlbum () {
- if (!this->head) this->head = new node (s, t);
- else {
- node* curr = new node (s, t);
- curr->next = this->head, this->head = curr;
- }
- }
- int main () {
- std::cin >> n;
- for (int i = 1; i <= n; ++ i)
- std::cin >> s >> t, p->citireAlbum ();
- p->display_all ();
- return 0;
- }
Add Comment
Please, Sign In to add comment