0

A Get function’s inverse

For my code, I have two functions, “get_no_of_students”, and “add_student”. How would I go about creating a “drop_student” function that removes a student that I have added? https://code.sololearn.com/cCIDeBB1cZCE/#cpp This is the code for my cpp file, i will link the header as well edit: https://code.sololearn.com/c6g42qUYhbCA/#cpp

23rd Feb 2019, 2:48 PM
Seij Bailey
Seij Bailey - avatar
4 Respostas
+ 4
That would depend somewhat on how you implemented the other functions (or class with methods). Care to share your code? You can upload it in Code Playground and link it here.
23rd Feb 2019, 3:00 PM
HonFu
HonFu - avatar
+ 1
https://code.sololearn.com/cCIDeBB1cZCE/#cpp This is the code for my cpp file, i will link the header as well edit: https://code.sololearn.com/c6g42qUYhbCA/#cpp
23rd Feb 2019, 3:32 PM
Seij Bailey
Seij Bailey - avatar
+ 1
You would need to iteratorate through the array of student names, checking to find a matching name. If found you can remove It be moving all the following names down one slot in your array. If order doesn't matter, then you can just assign the last name to the this slot. Then decrease the number of students by one.
24th Feb 2019, 1:06 AM
Jared Bird
Jared Bird - avatar
0
thanks so much đŸ‘đŸœ Jared Bird
24th Feb 2019, 2:00 AM
Seij Bailey
Seij Bailey - avatar