How to make File a Reference Parameter??

Here is the question:
Change function Print so it reads from file "data.in".
Make input file a ref. parameter to function Print.
Assume Name in one line & Address on another line.
-------------------------------
This is the error I get:
:10: missing terminating > character
:19: fstream): No such file or directory

Below is what I've tried so far..
-------------------------------

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

void Print(ifstream &jy);
// Post: Name and Address is written on the screen.

int main ()
{
ifstream fin;
fin.open("data.in");
if(fin)
Print(fin);

return 0;
}

//**************************************

void Print(ifstream &jy)
// Post: Name and Address is printed on the screen.

{

string Name;
string Address;

getline (jy, Name);
getline (jy, Address);

cout << Name << endl;
cout << Address << endl;

}
Last edited on
Which line of your code is the ":10: missing terminating > character" at?
#include <fstream)

Should be :
#include <fstream>
Lol didn't notice the simplest thing xD works well now thanks! :D
Topic archived. No new replies allowed.