trouble making c++ student class : <p>For my assignment I have to make a program to read student data from standard input, sort it by last name / first name, and print out the result to standard output. Students consists of a last name, first name, and a grade point average. It says to there are no more than 50 students.
It also says you should not rely on an external library function to do the sort.</p>

<p>Here is the example:</p>

<p>Ware Henry 87.2</p>

<p>Dantes Edmond 91.4</p>

<p>Earhart Amelia 92.6</p>

<p>Here is how it should be sorted:</p>

<p>Dantes Edmond 91.4</p>

<p>Earhart Amelia 92.6</p>

<p>Ware Henry 87.2</p>

<p>Here is the code I have so far that is not working properly:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

class student
{
public:
    student();
    void input();
    void output();
    void sort();
private:
    string Fname;
    string Lname;
    float gpa;
}

student::student()
{
    Fname = "";
    Lname = "";
    gpa = 0;
}

void student::input()
{
    cout &lt;&lt; "Enter first name, last name, and gpa"&lt;&lt;endl;
    cin &gt;&gt; Fname &gt;&gt; Lname &gt;&gt; gpa;
}

void student::sort()
{
    char temp;
    int count = 0;
    int i = 1;
    while (i &lt; word.size()) {
        if (word[i - 1] &gt; word[i]) {
            temp = word[i];
            word[i] = word[i + 1];
            word[i + 1] = temp;
            i++;
            if (i &gt;= word.size())
            {
                alpha(word);
            }
        }
        else
        {
            count++;
        }
    }
    return word;
}

void main()
{
    student.input();
}
</code></pre>

<p>Any advice on where I went wrong and any possible solutions?</p>
