class Student { public: 10101010 101012 0101100 Student() {}; Student(int ID, string name, string university){ m_university = university; Student:ID = ID; Student::name = name;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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
Transcribed Image Text: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
Expert Solution
STL Stack

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)

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY