请问这个程序错在哪里啊?
肖尧19 2002-11-05 03:29:28 #include <iostream.h>
#include <fstream>
#include <string>
using namespace std;
void main()
{
string filename;
cout<<"please input the filename"<<endl;
cin>>filename;
cout<<"now type the content of the file"<<endl;
ifstream infile("filename");
if(!infile)
{
cout<<"sorry,file not found"<<endl;
exit(-1);
}
string lineContent;
int lineNumber=1;
while(getline(infile,lineContent,'\n')
{
cout<<lineNumber<<" "<<lineContent<<endl;
lineNumber++;
}
}