// Ch. 11 Demo Program #5 // Mr. Minich // Purpose - passing a stream object as a parameter to a function #include <iostream.h>
#include <fstream.h>
int myFunc(istream &);
int main()
{
ifstream infile("temp.txt");
cout << myFunc(infile) << endl;
return 0;
}// end of main
int myFunc(istream &myFile)
{
int num = 0;
myFile >> num;
return num; }// end of myFunc
// note that istream objects are always passed by reference