Answer to Question #318958 in C++ for zizou

Question #318958

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.


1
Expert's answer
2022-03-27T07:57:50-0400
#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();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog