Файл List.cpp
#include <iostream> #include <string> #include <stdlib.h>
using namespace std;
#include "List.h"
void List::Read(string stroka, string stroka2) { unit *first; first = Begin; while (first->next) first = first->next; first->next = new unit; first = first->next; first->word = stroka; first->pages = stroka2; first->next =NULL; }; void List::Viev() { unit*first; char symbol = 186; first = Begin; first = first->next; while (first->next) { cout << symbol; cout.width(19); cout << first->word; cout.width(21); cout << symbol; cout.width(37); cout << first->pages << ';'; cout << symbol; first = first->next; } }; void List::Search(string str) { unit*first = Begin; char symbol = 186; while (first->next) { if (first->word == str || first->pages == str) { cout << symbol; cout.width(19); cout << first->word; cout.width(21); cout << symbol; cout.width(37); cout << first->pages << ';'; cout << symbol; } first = first->next; } };
void List::Sorting() { bool quit = false; while (quit!= true) { unit*first = Begin, *second = first->next; string temp, temp2; quit = true; while (second->next) { if (first->word.compare(second->word) > 0) { temp = first->word; temp2 = first->pages; first->word = second->word; first->pages = second->pages; second->word = temp; second->pages = temp2; quit = false; } first = first->next; second = second->next; } } };
|