Function for checking opened input file

This is what I have done so far:

//------------------------------------------------------------------------------
//Question3
//------------------------------------------------------------------------------
#include <iostream>
#include <fstream>
#include <string>
//------------------------------------------------------------------------------
using namespace std;
//------------------------------------------------------------------------------

bool OpenInputFile (istream &is)
{
if(is==cin)
return true;
else
return false;
}

int main()
{
ifstream inputFile;
string inputFileName;

cout << "**** Program to test input File function ****";

cout << "\n\nInput file name: " << flush;
getline(cin,inputFileName);
inputFile.open(inputFileName.c_str());

cout << "\n\nPress Enter to exit program: ";

cin.get();
cin.get();


return 5;
}

This is what the assignment is telling me to do:

(3)Write the code to define a function named OpenInputFile to open a file for input. The return type of the function should be bool, and the function should return true if the file was open properly and it should return false if the file was not opened properly. It should take as its only argument an input stream variable. Should it be pass by value or pass by reference? Where should the name of the file be obtained? The code you write will answer these questions.

What I am having trouble with is how do I implement the function OpenInputFile into the main program so that I get the correct results? Can someone please fix my program up a little so that it runs the way it's suppose to or give me some assistance on what it is that I'm missing? I know that I'm not too far off.
http://www.cplusplus.com/reference/iostream/

For your homework enjoyment, a little light reading.
Topic archived. No new replies allowed.