七.#include3、tring.h>八.#include九.#include十.FILE*fp;十一.charstring(charc[]);//字符串处理十二.charch;十三.char*operate[6]={"+","-","*","/","++","--"};十四.char*note[4]={"//","/*","*/","""};十五.char*symbol[31]={"%","$","^","&","_","#","<","<=","=",">",">=","<>","<<","==","!=","&&","
4、
5、","!",十六.",","
6、;",":=",".","(",")","{","}","&&","
7、
8、","!","()",">>"};十七.char*keyword[35]={"iostream.h","include","break","case","char","const","continue","default","do","double",十八."else","enum","cin","float","for","goto","if","int","long","cout",十九."return","short","signed","sizeof","static","struct","s
9、witch","typedef","printf",二十."union","unsigned","void","volatile","while","main"};二十一.二十二.intsearch(charsearchstr[],inttype)//符号匹配查找二十三.{二十四.inti;二十五.switch(type)二十六.{二十七.case1:for(i=0;i<35;i++)二十八.{二十九.if(strcmp(keyword[i],searchstr)==0)三十.return1;三十一.三十二.}三十三.case2:三.{四.for(i=0;i<=5;i++
10、)五.{六.if(strcmp(operate[i],searchstr)==0)七.return1;八.}九.break;十.}十一.case3:for(i=0;i<31;i++)十二.{十三.if(strcmp(symbol[i],searchstr)==0)十四.return1;十五.}break;十六.case4:for(i=0;i<=3;i++)十七.{十八.十九.if(!strcmp(note[i],searchstr)&&i==3)二十.{二十一.string(searchstr);二十二.break;二十三.}二十四.elseif(!strcmp(note
11、[i],searchstr))二十五.return1;二十六.二十七.}break;二十八.}二十九.return0;三十.}三十一.三十二.charletter(charch)//字母处理三十三.{三十四.inti=-1;三十五.charletter[50];三十六.while(isalnum(ch)
12、
13、ch=='.')三十七.{三十八.letter[++i]=ch;三十九.ch=fgetc(fp);四十.}四十一.letter[i+1]=' ';四十二.if(search(letter,1))四十三.{四十四.cout<