Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- struct node
- {
- char info;
- node* next;
- };
- class List
- {
- protected: node * head, *marker, *pred;
- public:
- List();
- void Reset();
- void Move();
- bool EoL();//1 if marker=NULL
- void Add(char data);//useless
- void Del();
- };
- #include "stdafx.h"
- #include "List.h"
- List::List()
- {
- head = NULL;
- marker = NULL;
- pred = marker;
- }
- void List::Reset()
- {
- marker = head;
- pred = marker;
- }
- void List::Move()
- {
- marker = marker->next;
- }
- bool List::EoL()
- {
- return (marker==NULL);
- }
- void List::Add(char data)
- {
- node* p = new node;
- p->info = data;
- pred->next = p;
- p->next = marker;
- }
- void List::Del()
- {
- node* p = marker;
- Move();
- pred->next = marker;
- delete p;
- }
- #include "stdafx.h"
- #include "List.h"
- #include <fstream>
- using namespace std;
- class Redoct:public List
- {
- private:
- public:
- void creatList(ifstream & f);
- void IdWord();
- bool Begin(char a);
- bool End(char a);//маркер у нас на начале слова
- bool InWord(char a);
- bool Same(char *a, int n);
- node* Copy();// наоборот
- bool Palindrom();//
- void Perevorot();
- void Show();
- void Delet();///
- };
- #include "stdafx.h"
- #include "RedoctList.h"
- #include <fstream>
- #include <iostream>
- using namespace std;
- void Redoct::creatList(ifstream & f)
- {
- List();
- head = new node;
- char data;
- node* tail = head;
- while (f.get(data))
- {
- marker = new node;
- marker->info = data;
- marker->next = NULL;
- tail->next = marker;
- tail = marker;
- }
- marker = head;
- head=head->next;
- }
Advertisement
Add Comment
Please, Sign In to add comment