Implement below four functions related to map<string, string>students_list. The student_lists map is used to store student id and student’s name. Use student's name as the map’s key, and student id as the map’s value.
For example:
students_list[“John”] = “s109004502”
note: the first englisg letter of student id reprsents as the student’s grade. Therefore, if the student moves on to the next level, the englisg letter should go down in alphabetical order.
For example:
s109004502 => t109004502
z109004502 => a109004502
void New(map<string, string> &mp, string name, string id) – add the student’s information <name, id> into students_list.
note: if the student’s information is already existed, then update the student’s information.
For example:
new Taka x351010105 // students_list = {<Taka, x351010105>}
new Masato m11111111 // students_list = {<Taka, x351010105>, <Masato, m11111111>}
new Masato c199612121 // students_list = {<Taka, x351010105>, <Masato, c199612121>}
void Delete(map<string, string> &mp, string name) – delete the student’s information <name, id> inside students_list.
note: if there is no the student’s information, print string “No such student named: name” with a return value at the end.
For example:
new Taka x351010105 // students_list = {<Taka, x351010105>}
delete Masato // there is no Masato’s information
No such student named: Masato
delete Taka// students_list is empty, students_list = {}
void Show(map<string, string> &mp, string name) – print out the student’s information <name, id> inside students_list. The student’s name and the student’s id should be separate by a space ‘ ‘.
note: if there is no the student’s information, print string “No such student named: name” with a return value at the end.
For example:
new Taka x351010105 // students_list = {<Taka, x351010105>}
show Masato // there is no Masato’s information
No such student named: Masato
show Taka
Taka x351010105
void MoveOnNextLevel(map<string, string> &mp, string name) – update the student’s information <name, id> inside students_list.
note: if there is no the student’s information, print string “No such student named: name” with a return value at the end.
For example:
new Taka x351010105 // students_list = {<Taka, x351010105>}
moveon Masato // there is no Masato’s information
No such student named: Masato
moveon Taka // students_list = {<Taka, y351010105>}
moveon Taka // students_list = {<Taka, z351010105>}
moveon Taka // students_list = {<Taka, a351010105>}
There are four kinds of input command.
new name id – Call New(<map reference>, name, id).
delete name – Call Delete(<map reference>, name).
show name – Call Show(<map reference>, name).
moveon name– Call MoveOnNextLevel(<mapreference>, name).
Output followed by above rules.