我不明白为什么会发生这样,求解!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include//bits/stdc++.h
#include//help.h
cin>>name;
string c;
ifstream filein14("情况.txt",ios::in);
while(getline(filein14,c))
{
length_word[flag]=c.length()-1;
debug(length_word[flag]);
flag+=1;
if(c==name)
{
flag2=1;
break;
}
}
help.h的内容:
#include//bits/stdc++.h
using namespace std;
void debug(int a)
{
cout<<a<<endl;
}
void debug(char a)
{
cout<<a<<endl;
}
void debug(char* a)
{
cout<<a<<endl;
}
void debug(string a)
{
cout<<a<<endl;
}
情况.txt的内容(有部分中文乱码):
awdrgy
#1.0#3-3
dorothy
#2.2#0-0
sssusie
#1.0#3-0
ߴߴ
#1.0#4-0
perry
#4.0#7-2
Ʈ������
#4.0#7-0
输出:
8
7
6
7
6
7
3
7
4
解释:我输出了文件每行的长度
谁能告诉我为什么?