Question
Correct the following code (C++): #include using namespace std; struct UndergradStudents { int id; string first; string last; string major; double gpa[4]; }; int main()
Correct the following code (C++):
#include
struct UndergradStudents { int id; string first; string last; string major; double gpa[4]; }; int main() { UndergradStudents ug[3]; {{ 1, "Joe", "Shmoe", "EE";{3.8, 3.3, 3.4, 3.9;}} { 2, "Macy", "Chea", "CS";{3.9, 3.9, 4.0, 4.0;}} { 3, "Peter", "Patrick", "ME";{3.8, 3.0, 2.4, 1.9;}}} printRecords (ug,3); } void printRecords(UndergradStudents *records, int numrecords){ for (int i = 0; i Output should be:These are the student records: ID# 1, Shmoe, Joe, Major: EE, Average GPA: 3.60 ID# 2, Chen, Macy, Major: CS, Average GPA: 3.95 ID# 3, Patrick, Peter, Major: ME, Average GPA: 2.77
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started