# include & ltfstream & gt
# include & lt字符串& gt
使用命名空間std
舞蹈班
{
公共:
字符串名稱;
int num
danci(){ num = 0;name =““;};
};
void readfile(danci * & amp;英查爾國際貿易有限公司。計數器)
{
ifstream infile(“in . txt“);
如果(!infile){ cout & lt& lt“打不開!”& lt& ltendl返回;}
while(infile)
{
字符串溫度;
infile>& gttemp
int I = 0;
for(;我& lt櫃臺;i++)
{
if(temp = = inchar【I】。name){ in char【I】。num++;打破;}
}
if(I = = counter & amp;& ampin char【I】。名字!=溫度)
{
英查爾【櫃臺】。name = temp
英查爾【櫃臺】。num++;
counter++;
}
};
infile . close();
}
void out file(danci * inchar,int計數器)
{
of stream outfile(“out . txt“);
for(int I = 0;我& lt櫃臺;i++)
輸出文件& lt& lt“單詞”
}
void main()
{
danci * inchar = new danci【1000】;
int counter = 0;
readfile(inchar,counter);
outfile(in char,counter);
}