There are couple of errors.
1. The error is at
string fname, lname, number, hits, n,;
replace with
string fname, lname, number, hits, n;
Note the last "," before the semicolon

2. Replace
ofstream myfile (lname.txt_str());
With
ofstream myfile (lname.c_str());

Thanks
Shabbir