Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CustomList {
- private:
- char* buffer;
- int currentPos = 0;
- CustomList* next;
- public:
- CustomList() {
- buffer = new char[1024];
- next = new CustomList();
- }
- ~CustomList() {
- delete buffer;
- delete next;
- }
- void write(char word[]) {
- int counter = 0;
- while (word[counter] != *"") {
- if (currentPos == 1023) {
- clearLastInput(counter);
- currentPos = 0;
- next->write(word);
- }
- buffer[currentPos] = word[counter];
- currentPos++;
- counter++;
- }
- }
- void clearLastInput(int lastPositions) {
- for (int i = 1023; i > 1023 - lastPositions; i--) {
- buffer[i] = *"";
- }
- }
- char getWord() {
- char* word = new char[];
- int symPos = 0;
- while(buffer[currentPos] != *" ") {
- word[symPos] = buffer[currentPos];
- }
- return *word;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment