yah I tried that, here is the problem
I parsed through each line but at the beginig is where I have to hace a space number like:
Code:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
if(argc>1)
abort();
char a;
int count=0,lines=0;
ifstream in;
ofstream out;
in.open("c:\\luke\\new.txt");
out.open("c:\\luke\\new2.txt");
while(in.get(a))
{ if(a=='\n')
lines++;
}
cout<<lines<<endl;
in.close();
out.close();
return 0;
}
will become
Code:
0 #include <iostream.h>
0 #include <fstream.h>
0 #include <stdlib.h>
0 int main(int argc, char* argv[])
0 {
3 if(argc>1)
6 abort();
3 char a;
3 int count=0,lines=0;
3 ifstream in;
3 ofstream out;
3 in.open("c:\\luke\\new.txt");
3 out.open("c:\\luke\\new2.txt");
3 while(in.get(a))
3 { if(a=='\n')
3 lines++;
3 }
3 cout<<lines<<endl;
3 in.close();
3 out.close();
3 return 0;
0 }