下面是我写的代码,看看符不符合你的要求,有问题就告诉我。
#include
#include
using namespace std;
int main()
{
char filename[150];
char text[4000];
char rate[100];
int i,j;
ifstream infile;
while(1)
{
cout<<"请输入文件名:"<
infile.open(filename);
if(infile.is_open())
break;
cout<<"打开文件失败,请检查文件名是否正确!"<
}
infile.getline(text,4000,'\n');
infile.close();
int len=strlen(text);
j=0;
for(i=0;i
if(text[i]=='4' && text[i+1]=='0')
{
rate[j]=text[i+25];
++j;
}
}
if(i-11>=len)
--j;
cout<
}