Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

undefined 1 #include #include 2 3 5 6 4 class Student { public: int mid; double mGPA; std::string mAddress; std::string mBiography; 10 }; 7 8

image text in transcribedimage text in transcribedimage text in transcribedundefined

1 #include #include 2 3 5 6 4 class Student { public: int mid; double mGPA; std::string mAddress; std::string mBiography; 10 }; 7 8 9 11 13 12 int main(int argc, char *argv []) { Student *students = new Student [100]; Student ** studentsPtr = new Student*[100]; 14 15 16 17 srand (100); // Seed random number generator for (int i = 0; i mGPA > studentsPtr[j]->mGPA) { Student *temp studentsPtr[j]; studentsPtr[j] studentsPtr[j-1]; studentsPtr[j-1] temp; } 31 32 = 33 34 35 } 36 } 37 38 39 for (int i = 0; i mGPA); } 40 41 42 return 0; 43 } (a) What is the value of students? (b) What is the value of studentsPtr? (c) Which of the above is being sorted? (d) Why was the above (in c) chosen over the other? What advantage do you see? (e) Write the commands to free memory. 1 #include #include 2 3 5 6 4 class Student { public: int mid; double mGPA; std::string mAddress; std::string mBiography; 10 }; 7 8 9 11 13 12 int main(int argc, char *argv []) { Student *students = new Student [100]; Student ** studentsPtr = new Student*[100]; 14 15 16 17 srand (100); // Seed random number generator for (int i = 0; i mGPA > studentsPtr[j]->mGPA) { Student *temp studentsPtr[j]; studentsPtr[j] studentsPtr[j-1]; studentsPtr[j-1] temp; } 31 32 = 33 34 35 } 36 } 37 38 39 for (int i = 0; i mGPA); } 40 41 42 return 0; 43 } (a) What is the value of students? (b) What is the value of studentsPtr? (c) Which of the above is being sorted? (d) Why was the above (in c) chosen over the other? What advantage do you see? (e) Write the commands to free memory

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

Students also viewed these Databases questions