Write the Class Student which represent the student Object considering that the students has ID, Name and email as attributes and you need to suggest one method.
#include <iostream>
#include <string>
using namespace std;
class Student
{
int ID;
string Name;
string email;
public:
Student(){}
Student(int _ID, string _Name, string _email)
:ID(_ID), Name(_Name), email(_email){}
void Assign()
{
cout << "Please, enter an ID of student: ";
cin >> ID;
cout << "Please, enter a Name of student: ";
cin >> Name;
cout << "Please, enter an email of student: ";
cin >> email;
}
void Show()
{
cout << "\nInfo about student: ";
cout << "\nID:\t" << ID;
cout << "\nName:\t" << Name;
cout << "\nEmail:\t" << email;
}
};
int main()
{
Student x(123, "Jack", "Jack@com");
Student y;
y.Assign();
x.Show();
y.Show();
}
Comments
Leave a comment