#include<iostream>
using namespace std;

struct address
{
	char street[30];
	char city[30];// added city member
	char state[2];
	int zip;// no need for array
};

struct student
{
	address home;
	char first[15];
	char last[20];
	int year;//no need for an array
};

int main()
{
    student s[2];  // array of two student structures
    int i, j;

    for (i = 0; i < 2; i++)
    {
    cout << "Enter Student First Name:  ";
    cin >> s[i].first;   // input into the ith student's first name field
    cout << "Enter Student Last Name:  ";
    cin.ignore(1, '\n');   // clear enter
    cin >> s[i].last;
    cout << "Enter Street Address:  ";
    cin.ignore(1, '\n');
    cin.getline(s[i].home.street, sizeof(s[i].home.street), '\n'); /* whole line for street*/
    cout << "Enter City:  ";
    cin.getline(s[i].home.city, sizeof(s[i].home.city), '\n');
    cout << "Enter State (ex. NY):  ";
    cin >> s[i].home.state;
    cout << "Enter Zip Code:  ";
    cin.ignore(1, '\n');
    cin >> s[i].home.zip;
    cout << "Enter Class Year:  ";
    cin >> s[i].year;
    cout << endl;
    }

            // pass student array to separate function - student pointer

    for (j = 0; j < 2; j++) // change to while pointer comparison loop
    {
    cout << "\n\n";    // change to print fields using pointer and arrow operator
    cout << s[j].first << " " << s[j].last << "  " << s[j].year << endl;
    cout << s[j].home.street << endl;
    cout << s[j].home.city << ", " << s[j].home.state << "  " << s[j].home.zip << endl;
    }
}