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. }
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 (
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.
}
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)