void OpenAndReadFile(string Filename, house FileHouses[MAXHOUSES])
{
//create input filestream and open the file
ifstream fin(Filename.c_str() );
fin.open(Filename.c_str());
//if the file didn't open, display an error and terminate the program.
if (!fin.is_open())
{
cout << "There was an error opening the file" << endl;
system("pause");
exit(1);
}
//this for loop reads each line in the file and saves everything into the array for houses.
for (int Count = 0;Count < MAXHOUSES;Count++)
{
getline(fin,FileHouses[Count].Address);
getline(fin,FileHouses[Count].Suburb);
fin >> FileHouses[Count].Price;
}
//close the file
fin.close();
}