class Student { public: 10101010 101012 0101100 Student() {}; Student(int ID, string name, string university){ m_university = university; Student:ID = ID; Student::name = name;
![13)
0101011111
010101010101
1101010101
01100
Read the following class definition and answer afterword:
class Student {
public:
Student() {};
Student(int ID, string name, string university){
m_university = university;
cam
Student:ID = ID;
Student::name = name;
};
string getUniName() {return m_university;}
string getStudentName() {return m_name;}
void print() {
cout << "Student ID is: "<<ID<<endl;
cout<<"Student name is: "<<m_name<<endl;
cout<<"Student university is: "<<m_university<<endl;
}
Private:
int ID;
string m_name;
string m_university;
};
**************
00101
11101101
0101010111111
1010101010101
111010101010
1011004
Q: A chess game will be played between two universities (JU and JUST), four
students will played in the game (two from JU and two from JUST).
Students indo is stored in a file Called 'student_data.txt', where the file
contains the information of four students from two universities as follows:
123 Ali JU
456 Ahmad JUST
789 Sara JU
258 Lara JUST
Where Ali will play Ahmad, and Sara will play Lara.
Write the main function only in which you need to declare an STL stack of
type Student, and fill it with the student information that is stored in the
text file.
Then, you need to declare and fill an STL map of type string(for both key
and value) using the student information stored in the previously declare
stack. Each key of the new map is the student's name of a student who
studies at JU and the value will be the student's name of the student
studies at JUST.
BOUNUS: print the map information and show the following:
Ali will play with Ahmad
Sara will play with Lara](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe444b5e4-3657-44ce-8fa3-69e9397b0e32%2Fe831f58d-243e-4802-87a8-d60b74d4c732%2Fg7zyexi_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Stack is a kind of container adapter with LIFO (Last In First Out) operation, where a new element is added at one end (top) and an element is removed only at that end. Stack uses an encapsulated vector or deque object or list (sequential container class) as its underlying container, providing a specific set of member functions to access sections. its death.
Stack Syntax:-
To create a stack, we need to include the header file in our code. Then we use this syntax to define std::stack:
model xss = remove>> class stack;
Type - is the Type of the element contained in the std:: stack. It can be any valid C++ type or even a user-defined type. Container - is the underlying container object type.
Membership Types:-
value_type - The first template parameter, T. It specifies the element type.
container_type - Second template parameter, Container. It indicates the underlying container type. size_type - Unsigned integral type.
The stack related functions are:
empty() - Returns if stack is empty - Time complexity: O(1)
size() - Returns the stack size - Time complexity: O(1)
top() - Returns a reference to the top element in the stack - Time complexity: O(1)
push(g) - Add `g` element to top of stack - Time complexity: O(1)
pop() - Remove top item from stack - Time complexity: O(1)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)