Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- ////////////////////////////////////////////
- struct TT
- {
- int nData;
- TT *pNext;
- };
- ////////////////////////////////////////////
- class LL
- {
- public:
- TT *pHead;
- TT *pTail;
- int nCounter;
- /////////////
- LL()
- {
- pHead = 0;
- pTail = 0;
- nCounter = 0;
- }
- void push(int n)
- {
- TT *p = (TT*)malloc(sizeof(TT) );
- if(pHead == 0) // Если список пуст
- {
- pHead = p;
- }
- else
- {
- pTail->pNext = p;
- }
- pTail = p;
- nCounter ++;
- }
- };
- ////////////////////////////////////////////
- int main() //
- {
- LL list_1;
- list_1.push(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement