當前位置:成語大全網 - 書法字典 - 計數器建立壹個字典

計數器建立壹個字典

# include & ltiostream & gt

# 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 & gt& gt溫度;

int I = 0;

for(;我& lt櫃臺;i++)

{

if(temp==inchar[i]。name) { inchar[i]。num++;打破;}

}

if(I = = counter & amp;& amp因查爾[i]。名字!=溫度)

{

in char[櫃臺]。name = temp

in char[櫃臺]。num++;

counter++;

}

};

infile . close();

}

void outfile(danci*inchar,int計數器)

{

of stream outfile(" out . txt ");

for(int I = 0;我& lt櫃臺;i++)

outfile & lt& lt“單詞”

}

void main()

{

danci * inchar = new danci[1000];

int counter = 0;

readfile(英制,計數器);

outfile(inchar,計數器);

}