NikitaGru

Untitled

Mar 17th, 2021
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. class CustomList {
  2. private:
  3. char* buffer;
  4. int currentPos = 0;
  5. CustomList* next;
  6.  
  7. public:
  8. CustomList() {
  9. buffer = new char[1024];
  10. next = new CustomList();
  11. }
  12.  
  13. ~CustomList() {
  14. delete buffer;
  15. delete next;
  16. }
  17.  
  18. void write(char word[]) {
  19. int counter = 0;
  20.  
  21. while (word[counter] != *"") {
  22. if (currentPos == 1023) {
  23. clearLastInput(counter);
  24. currentPos = 0;
  25. next->write(word);
  26. }
  27. buffer[currentPos] = word[counter];
  28. currentPos++;
  29. counter++;
  30. }
  31. }
  32.  
  33. void clearLastInput(int lastPositions) {
  34. for (int i = 1023; i > 1023 - lastPositions; i--) {
  35. buffer[i] = *"";
  36. }
  37. }
  38.  
  39. char getWord() {
  40. char* word = new char[];
  41. int symPos = 0;
  42.  
  43. while(buffer[currentPos] != *" ") {
  44. word[symPos] = buffer[currentPos];
  45. }
  46.  
  47. return *word;
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment