// example illustrating the passing of a structure into a function #include #include using namespace std; struct Student { char fName[20]; // first name char lName[20]; // last name int socSecNumber; // social security number double gpa; // grade point average }; void PrintStudent(Student s); // struct passed as parameter int main() { Student s1 = {"John", "Smith", 123456789, 3.75}; Student s2 = {"Alice", "Jones", 123123123, 2.66}; Student s3 = {"Marvin", "Dipwart", 999999333, 1.49}; PrintStudent(s1); PrintStudent(s2); PrintStudent(s3); return 0; } void PrintStudent(Student s) // prints the internal data of any student structure passed in { cout << left; cout << setw(20) << s.fName << ' ' << setw(20) << s.lName << " " << setw(10) << s.socSecNumber; cout << " GPA: " << right << fixed << setprecision(2) << setw(4) << s.gpa << '\n'; }