Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CODE C++ PLEASE #include <iostream> #include <string> #include <vector> #include

ID: 3938432 • Letter: C

Question

CODE C++ PLEASE

#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>

using namespace std;

class Student {
public:
   Student(string name = "not intialized", double GPA = 0.0);
   void SetName(string studentName);
   void SetGPA(double personName);
   string ToString() const;
private:
   string name;
   double GPA;
};

Student::Student(string initialName, double initialGPA) {
   name = initialName;
   GPA = initialGPA;
}

void Student::SetName(string inputName) {
   name = inputName;
}

void Student::SetGPA(double newGPA) {
   GPA = newGPA;
}

//Insert the ToString member function here

int main() {
   vector<Student*> students;

   //Insert your code for main here

   return 0;
}

Explanation / Answer

Please find the code for main function:

int main() {
vector<Student*> students;
int i =0;
string opt;
char ch;
do
{
cout<<"Enter Option ";
cin>>opt;
switch (opt)
   {
       case add: students.push_back(Setname(i));
               students.push_back(SetGPA(i));
               i++;
               break;
       case print: students(Tostring());  
               break;
       case drop: students.erase(students.begin()+i);
                   i--;
                   break;      
   }
cout<<"want to terminate, enter y";
cin>>y;
}while(ch=='y' !! ch=='Y');
  
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote