displays all the following students’ attributes
1 Student Name
2 ID
3 Gender
4 Group
5 Score
6 Grade
#include <iostream>
using namespace std;
class Student
{
private:
string Student_name;
int ID;
string gender;
string group;
int score;
string grade;
public:
Student(string n,int a, string t,string b,int c, string d)
{
Student_name=n;
ID=a;
gender=t;
group=b;
score=c;
grade=d;
}
void setStudent_name(string n)
{
Student_name=n;
}
void setID(int a)
{
ID=a;
}
void setgender(string t)
{
gender=t;
}
void setgroup(string b)
{
group=b;
}
void setscore(int c)
{
score=c;
}
void setgrade(string d)
{
grade=d;
}
string getStudent_name()
{
return Student_name;
}
int getID()
{
return ID;
}
string getgender()
{
return gender;
}
string getgroup()
{
return group;
}
int getscore()
{
return score;
}
string getgrade()
{
return grade;
}
void input(string n, int a, string t,string b,int c, string d)
{
Student_name=n;
ID=a;
gender=t;
group=b;
score=c;
grade=d;
}
void Change(string n, int a, string t,string b,int c, string d)
{
Student_name=n;
ID=a;
gender=t;
group=b;
score=c;
grade=d;
}
void Display()
{
cout<<"Student Student_name is:"<<Student_name<<endl;
cout<<"Student ID is:"<<ID<<endl;
cout<<"Student gender is:"<<gender<<endl;
cout<<"Student group is:"<<group<<endl;
cout<<"Student score is:"<<score<<endl;
cout<<"Student grade is:"<<grade<<endl;
}
};
int main()
{
string Student_name;
int ID;
string gender;
string group;
int score;
string grade;
cout<<"Enter Student_name of The Student:"<<endl;
cin>>Student_name;
cout<<"Enter ID of the Student:"<<endl;
cin>>ID;
cout<<"Enter gender of the Student:"<<endl;
cin>>gender;
cout<<"Enter group of The Student:"<<endl;
cin>>group;
cout<<"Enter score of the Student:"<<endl;
cin>>score;
cout<<"Enter grade of the Student:"<<endl;
cin>>grade;
Student obj(Student_name, ID, gender, group, score, grade);
obj.input(Student_name, ID, gender, group, score, grade);
obj.Display();
return 0;
}
Comments
Leave a comment