/****************************************************************************************** ex5.cpp extended OOP object in a "traditional" array, input from a file ******************************************************************************************/ #include <iostream> #include <string> #include <fstream> using namespace std; //class definition class name { public: string first; string last; int age; }; void main() { int i; const int maxsize=6; name family[maxsize]; ifstream fin("family.txt"); for (i=0; i < maxsize; i++) { fin >> family[i].first >> family[i].last >> family[i].age; } for (i=0; i < maxsize; i++) { cout << family[i].last << ", " << family[i].first << endl << " Aged " << family[i].age << " years." << endl; } return; }