Unable to output anything.
<p>I am working on my final project for my c++ class. The instructions are not clear but in either case, I have compiled my code but it won't output anything. Could you please review my code and let me know what I am missing? Here is what she is asking for:</p>

<hr>

<p>This program will include error trapping with try and catch.</p>

<p>Put a throw in each function which gets user input and throw a string "Bad Major" if a Major of 0 is entered. The input functions are specified in 2, 4 and 7 below.</p>

<p>Create a global structure as follows:</p>

<pre><code>struct Student 
{ 
       char Name[30]; 
       float GPA; 
       int Major; 
};
</code></pre>

<ol>
<li><p>In main create 2 instances of that structure. Call them S1 and S2. </p></li>
<li><p>Create and call a function named StudentData:
S2 = StudentData( S1 ); //this is the call to the function
The function receives as a parameter a reference to the structure (prototyping will handle this) and will return a reference to the structure. Use couts and cins for getting data from the user. For testing purposes, change the data in S1 so that the GPA is 3.5 and the Major is 2. Since you are to use cins for getting data from the user, you are the user and just enter these values. After the call to the function both S1 and S2 will contain the same data.</p></li>
<li><p>In main print the data stored in the structures S1 and S2 using cout.  </p></li>
<li><p>Call a function named ChangeData with a pointer to S2 as the argument:
        ChangeData( &amp;S2 ); //this is the call to the function
Change the data in S2 so that the GPA is 3.0 and the Major is 1. (Using these values for testing…) </p></li>
<li><p>Back in main print the data stored in the structure S2 using cout.</p></li>
<li><p>Now create an array of 2 structures in main. Call the array Students. </p></li>
<li><p>Create a function, GetStudents, which will receive the array and an int representing the number of elements(2). In the function, loop through the data and get all three fields from the user using cin, cin.getline and cout statements. Organize like this: </p></li>
</ol>

<p>for (...........) 
    { 
    cout prompt to user 
    cin.getline for name 
    cout prompt to user 
    cin for GPA
    cout promp to user
    cin for Major 
    cin.ignore(1); 
    }</p>

<p>The problem is that a cin for a numeric value will leave the ENTER key in the keyboard buffer and that is OK with cin and other numbers but not with strings, thus we must remove it on our own. cin.ignore should handle this for us.</p>

<ol>
<li><p>Call the function GetStudents from main. </p></li>
<li><p>Create a function, PrintStudents, which will receive the same arguments as GetStudents. It will print out the array of students on 2 lines, 1 line per student.</p></li>
</ol>

<p>Now here is my code:</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;iomanip&gt;

using namespace std;

//Global variable to determine size of name
const int Name_Size = 30;

//Structure
struct Student
{
    char Name[30];
    float GPA;
    int Major;
};

//Function Prototypes
Student* studentData(Student &amp;S1);
Student* changeData(Student &amp;S2);
Student getStudent(Student array[], int size);
Student printStudents(Student array[], int size);

int main()
{
    Student S1; // structure instance called S1.
    Student S2; // structure instance called S2.

    Student student[2]; //array of 2 structures.

    S2 = *studentData(S1); //Calls the studentData function.

    changeData(S2); //Calls the changeData function.

    getStudent(&amp;S1, 2); //Calls the getStudent function.

    printStudents(&amp;S1, 2); //Calls the printStudents function.

    system("pause");
    return 0;
}

//Function Definitions

//studentData function
Student* studentData(Student &amp;S1)
{
        cout &lt;&lt; "Student 1" &lt;&lt; endl;
        cout &lt;&lt; "_________" &lt;&lt; endl;
        cout &lt;&lt; "Name: " &lt;&lt; S1.Name &lt;&lt; endl;
        cout &lt;&lt; "GPA: " &lt;&lt; S1.GPA &lt;&lt; endl;
        cout &lt;&lt; "Major: " &lt;&lt; S1.Major &lt;&lt; endl;
        cout &lt;&lt; endl;

    if (S1.Major == 0)
    {
        throw "Bad Major!\n";
    }
    else 
        return &amp;S1;
}

Student* changeData(Student &amp;S2)    // Changes the data.
{
        cout &lt;&lt; "Name: " &lt;&lt; S2.Name &lt;&lt; endl;
        cout &lt;&lt; "GPA: " &lt;&lt; S2.GPA &lt;&lt; endl;
        cout &lt;&lt; "Major: " &lt;&lt; S2.Major &lt;&lt; endl;

    if (S2.Major == 0)
    {
        throw "Bad Major!\n";
    }
    else 
        return &amp;S2;     
}

Student getStudent(Student array[], int size) //Function and loop to receive the array and an int representing the number of elements(2). 
{
    for (int index = 0; index &lt; size; index++)
    {
        cout &lt;&lt; "Please enter students full name: ";  
        cin.getline(array[index].Name, 30);
        cout &lt;&lt; "Please enter students GPA: ";
        cin &gt;&gt; array[index].GPA;
        cout &lt;&lt; "Please enter students major: ";
        cin &gt;&gt; array[index].Major;
        cin.ignore(1);
    }
    if (array[1].Major == 0 || array[2].Major == 0)
    {
        throw "Bad Major!\n";
    }
    else
        return array[size];
}

Student printStudents(Student array[], int size)
{
    for (int index = 0; index &lt; size; index++)
    {
        cout &lt;&lt; array[index].Name &lt;&lt; "  " &lt;&lt; array[index].GPA &lt;&lt; "  " &lt;&lt; array[index].Major &lt;&lt; endl;
        return array[size];
    }
}
</code></pre>
