Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class List{
- public:
- List(){ next = NULL; data = 0;}
- int data;
- List* next;
- };
- int pop(List* x){ // delete one from the end and type data ||-||-/ *5*
- return x->data;
- }
- void push (List* root, int value){ // insert line to the end ||-||-|new|
- List *node = new List();
- node->data = value;
- node->next = root;
- root = node;
- cout << root->data << endl;
- }
- int main(){
- List root;
- push(&root, 10);
- cout << root.data << endl;
- cout<< pop(&root);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement