Need help with programming assignment!!

Hey guys, i am having trouble finishing my program. Here's the program. I am getting an error saying my 'fin' is not declared. I also need to include a loop to allow the user to enter the file name twice before exiting if the file does not exist that they entered. Here is my program that i have typed up so far. If anyone has any answers that would be great. Thanks!

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

void showContent(fstream &);

int main(void)
{
string fileName;
char line[100];
fstream fin;
fstream dataFile;

cout << "Please enter the Filename: " << endl;
cin >> fileName;

fin.open(fileName.c_str(), ios::in);
dataFile.close();

showContent(dataFile);

while(!fin)
{
cout << "Error Opening File! Re-enter File Name: " << endl;
cin >> fileName;
}

system("pause");
}

void showContent(fstream &file)
{
int counter = 0;
char getch();

while(!fin.eof())
{
if (counter > 21)
{
getch();
counter = 0;
}

fin.getline(line, 101, '\n');
cout << line << endl;
counter++;
}
}
Instead of fstream fin; it should be ifstream fin;
@fiji885 it still says 'fin' is not declared
fin is not declared in function showContent. You need to rename the argument "file" as "fin".
Don't create a second post for just the same topic.
http://www.cplusplus.com/forum/general/230060/
I need to include a loop in this program where if the user enters the wrong file name, it allows the user to enter it two more times before exiting.
Have a look here, seems the same problem:
http://www.cplusplus.com/forum/beginner/230066/#CH_i1041701
Topic archived. No new replies allowed.