小弟我用的VC++6.0 感觉编译器好像出有关问题了,求帮助

我用的VC++6.0 感觉编译器好像出问题了,求帮助
//此程序为词法分析器,请注意,所给代码必须有终止符,否则程序有可能崩溃
#include <iostream>
#include <string>
#include <fstream>
#include <cctype>
#include <list>
using namespace std;
ofstream fin;
//定义关键字表和特殊字符表的结构体
struct code_page
{
char *name;
int num;
};

//关键字表
code_page key[6]={{"main",26},{"int",21},{"if",22},{"then",23},{"else",24},{"return",25}};

//特殊字符表
code_page code[12]={{"(",1},{")",2},{"{",3},{"}",4},{";",5},{"=",6},{"+",7},{"*",8},{">",9},{"<",10},{",",11},{"\'",12}};

//构建存储词法分析结果的链表
list<code_page>clist;

//判断字符串是否为关键字,是关键字则返回关键字代码,否则返回0
int IsKey(string a)
{
int i=0,j=-1;
for(i=0;i<6;i++)
{
if(strcmp(key[i].name,a.c_str())==0)
j=i;
}
return j;
}

//判断字符是否为特殊字符,如果是则返回字符代码,否则返回0
int Iscode(char ch)
{
int i=0,j=-1;
for(i=0;i<12;i++)
{
if(ch==code[i].name[0])
j=i;
}
return j;
}
//输出链表
void display()
{
list<code_page>::iterator i;
for(i=clist.begin();i!=clist.end();i++)
{
cout<<"("<<(*i).num<<","<<"\'"<<(*i).name<<"\'"<<")"<<endl;
fin<<"("<<(*(i)).num<<","<<"\'"<<((*(i))).name<<"\'"<<")"<<endl;
}
}
//词法分析器
void analyse()
{
clist.clear();
FILE *txt;
char name[40];
cout<<"请输入要分析的代码的完整路径及后缀:";
while(1)
{
cin>>name;
if((txt=fopen(name,"r"))==NULL)
cout<<"文件不存在,请重新输入!"<<endl;
else
break;
}
cout<<"读取代码成功!"<<endl;
cout<<"词法分析结果如下:"<<endl<<endl;
cout<<"<<<<<<<<<<<<<<<<<<<"<<endl;

fin.open("词法分析结果.txt");
char ch=fgetc(txt);

//开始对代码进行分析
while(ch!=EOF)
{
string carry;
if(ch==' '||ch=='\t'||ch=='\n')//对空格、制表符tab、换行符的处理
{

}


//判断是否为变量名或关键字
else if(isalpha(ch))// isalpha(ch)判断是否为字母
{
while(isalnum(ch))// isalnum(ch)判断是否为字母或数字
{
ch=tolower(ch);//把字母转换成小写字母
carry+=ch;
ch=fgetc(txt);
}

fseek(txt,-1L,SEEK_CUR);

if(IsKey(carry)!=-1)//判断是否为关键字
{
int i=IsKey(carry);
clist.insert(clist.end(),key[i]);//讲该关键字插入链表尾
}
else
{
const char *arr=carry.c_str();
char *r=new char[strlen(arr)+1];
strcpy(r,arr);
code_page other;
other.name=r;
other.num=0;
clist.insert(clist.end(),other);
}
}//一个变量名或关键字分析完毕


else if(isdigit(ch))//分析是否为数字
{
while(isdigit(ch))
{
carry+=ch;
ch=fgetc(txt);
}
fseek(txt,-1L,SEEK_CUR);
const char *arr=carry.c_str();
char *r=new char[strlen(arr)+1];
strcpy(r,arr);
code_page other;
other.name=r;
other.num=0;
clist.insert(clist.end(),other);
}//一个数字分析完毕

//判断是否为特殊字符
else if(Iscode(ch)!=-1)
{
int i=Iscode(ch);
clist.insert(clist.end(),code[i]);
}//是否为特殊字符判断完毕

else//其他字符种类都归结为100
{
code_page other;
other.name="-";
other.num=100;
clist.insert(clist.end(),other);
}//其他情况判断完毕


ch=fgetc(txt);//再读取一个字符
}
display();