C++ Please Note the code is not 100% typed and checked for accurate c++ I just am typing the visual of what the program look like.  How do you use a class in a switch case? I know how to do struct but trying to learn how to utilize the class method better. I am going to show you a visual but I would like an example how it works.  this is the way I have it visually please start however you want if you have a better idea. My main question is where I ask for the name, GPA and Degree in the switch statement #include #include using namespace std; Class student { private: string full_name; int GPA; string Degree; Public: void SetStudentdata(string FN, int gpa, string DG) { full_name=FN; GPA=gpa; Degree=DG; } void getstudentdata(string &FN, int &gpa, string DG) { FN=full_name; gpa=GPA; DG=Degree; }; void addstudent (vector&); void displaystudent (vector&); void editstudent (vector&); int main() int choice; vectorStudents; cout<<"Please choose one"; cout<<"1. add student"; cout<< "2. display student"; cout<<"3. Edit student"; cin>>choice; switch(choice) case 1: addstudent(Students); <- here is idea where I would have the input function case 2: displaystudent(Students); case 3: editstudent(Students); return 0; } void addstudent (vector&Students); { cout<<"Enter full name"; This is where I am stuck. Am I going the right way? Or is there a better way in this part? Please redo it all if I am not getting to a right start because my mind is stuck in a struct mode. I can do struct but I want to to be used to a class as well. }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ Please

Note the code is not 100% typed and checked for accurate c++ I just am typing the visual of what the program look like. 

How do you use a class in a switch case? I know how to do struct but trying to learn how to utilize the class method better. I am going to show you a visual but I would like an example how it works. 

this is the way I have it visually please start however you want if you have a better idea. My main question is where I ask for the name, GPA and Degree in the switch statement

#include <iostream>
#include <iomanip>

using namespace std;

Class student

{

private:

string full_name;

int GPA;

string Degree;

Public:

void SetStudentdata(string FN, int gpa, string DG)

{

full_name=FN;

GPA=gpa;

Degree=DG;

}

void getstudentdata(string &FN, int &gpa, string DG)

{

FN=full_name;

gpa=GPA;

DG=Degree;

};

void addstudent (vector<Student>&);

void displaystudent (vector<Student>&);

void editstudent (vector<Student>&);

int main()

int choice;

vector<Student>Students;

cout<<"Please choose one";

cout<<"1. add student";

cout<< "2. display student";

cout<<"3. Edit student";

cin>>choice;

switch(choice)

case 1: addstudent(Students); <- here is idea where I would have the input function

case 2: displaystudent(Students);

case 3: editstudent(Students);

return 0;

}

void addstudent (vector<Student>&Students);

{

cout<<"Enter full name";

This is where I am stuck. Am I going the right way? Or is there a better way in this part? Please redo it all if I am not getting to a right start because my mind is stuck in a struct mode. I can do struct but I want to to be used to a class as well.

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education