Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы / С++.ЭТМО / 4 - Poisk Stroki / Lab3-4
.cpp#include <iostream.h>
#include <string.h>
#include "strList.h"
StList sorted;
void al(char *x)
{
sorted.Add(x);
}
void addAllLexems()
{
al("asm");
al("auto");
al("bool");
al("break");
al("case");
al("catch");
al("char");
al("class");
al("const");
al("const_cast");
al("continue");
al("default");
al("delete");
al("do");
al("double");
al("dynamic_cast");
al("else");
al("enum");
al("explict");
al("export");
al("extern");
al("false");
al("float");
al("for");
al("friend");
al("goto");
al("if");
al("inline");
al("int");
al("long");
al("mutable");
al("namespase");
al("new");
al("operator");
al("private");
al("protected");
al("public");
al("register");
al("reinterpret_cast");
al("return");
al("short");
al("signed");
al("sizeof");
al("static");
al("static_cast");
al("struct");
al("switch");
al("template");
al("this");
al("throw");
al("true");
al("try");
al("typedef");
al("tipeid");
al("typename");
al("union");
al("unsigned");
al("using");
al("virtual");
al("void");
al("volatile");
al("wchar_t");
al("while");
}
Cell *FindSt(char *x, StList *li)
{
Cell *tmp;
int i=0;
tmp=li->First();
while(tmp->Next!=NULL)
{
i=0;
while(tmp->x[i++]==x[i])
{
if(x[i]=='\0') return tmp;
}
tmp=tmp->Next;
}
return NULL;
}
void main()
{
char word[20];
addAllLexems();
cout<<"Enter the lexem of cpp language to get adress of cell"<<endl;
cin>>word;
cout<<FindSt(word,&sorted)<<endl;
cin.get();
cin.get();
}
Соседние файлы в папке 4 - Poisk Stroki