#include #include using namespace std; /* First attempt struct Person { string name; int bdate; // e.g. 20170118 for 18 Jan 2017 int phone; }; typically int = 32 binary digits min = (-2) to power of 31 max = (2 to power 31) - 1 power(2, 31) = power(2, 10) * power(2, 10) * power(2, 10) * power(2, 1) power(2, 10) = roughly 1000 (really 1024) so power(2, 31) = about 2,000,000,000 birth date fits phone number 999-999-9999 9,999,999,999 doesn't fit therefore change plan */ struct Person { string name; int bdate; // e.g. 20170118 for 18 Jan 2017 string phone; }; void print(Person & p) // & means reference parameter, not a copy // saves time not making copies of params { cout << p.name << ", born " << p.bdate << ", ph " << p.phone << "\n"; } int main() { Person a[100]; a[0].name = "Jill"; a[0].bdate = 19970225; a[0].phone = "(212) 111-2222"; a[1].name = "Joe"; a[1].bdate = 19460812; a[1].phone = "(786) 222-3333"; // c is Jil''s twin brother, same phone too a[2] = a[0]; a[2].name = "Jim"; for (int i = 0; i < 3; i += 1) { cout << "a[" << i << "] is "; print(a[i]); } }