Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
created by st10 at Wed Dec 3 12:18:18 PST 2003
--------------------------------------------------*/
#include <iostream>
#include "Student2.h"
using namespace std;
/*--------------------------------------------------
Contract: uglyFunct : Student -> void
Purpose: UGLY style function that changes the value
of its pass-by-value copy of the argument
st to have a last grade of 937. It prints a
message to the screen, too.
Examples: for Student st1, with 3 grades,
uglyFunct(st1) should cause to be printed:
uglyFunct: changed COPY's grade 2 to 937
for Student st2, with NO grades,
uglyFunct(st2) should cause to be printed:
uglyFunct: COPY had no grades...
--------------------------------------------------*/
void uglyFunct(Student st)
{
int lastGradeIndex = st.get_numGrades() - 1;
st.set_lastName("Hello There");
cout << "uglyFunct: COPY's last name is now: "
<< st.get_lastName() << endl;
if (lastGradeIndex == -1)
{
cout << "uglyFunct: COPY had no grades..." << endl;
}
else
{
st.set_grade(lastGradeIndex, 937);
cout << "uglyFunct: changed COPY's grade "
<< lastGradeIndex << " to 937" << endl;
}
}