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.
}

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









