Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <MassivSort.h>
- using namespace std;
- MassivSort::MassivSort(unsigned int n)
- {
- n_ = n;
- head = new Num_Massive();
- tail = head;
- for (int i = 1; i < n; i++)
- {
- if (i%10 == 0)
- {
- Num_Massive * buf = new Num_Massive();
- tail->next = buf;
- tail = buf;
- delete buf;
- }
- }
- tail->lngth = n%10+1;
- tail->next = NULL;
- }
- MassivSort::DeleteEl(unsigned int pos)
- {
- if (n_ == 1)
- {
- n_--;
- head = NULL;
- tail = NULL;
- return;
- }
- Num_Massive * buftail = head;
- for(int i = 1; i <= pos; i++)
- {
- if(i%10 == 0)
- {
- buftail = buftail->next;
- }
- }
- if (n_%10 == 1)
- {
- Num_Massive * buftail;
- }
- else
- {
- for (; i<n_; i++)
- {
- if(i%10 == 0)
- {
- buftail = buftail->next;
- }
- }
- }
- n_--;
- }
- MyError::MyError(const char *s, int c)
- {
- code_=c;
- strncpy(message_, s, 100);
- }
Add Comment
Please, Sign In to add comment