Hi, cppnoobie.
I glanced through your code on www.onlinegdb.com and I wonder weather it is either an exercise or an assignment, or is something you’re doing by your own. I mean, what’s the advantage of that linked list to store your data? Are there constraints that require it? And what’s bad in std::list? Are you required to write your own version?
Apart from the vintage C-style syntax
1 2 3 4 5 6 7 8
|
typedef struct TNode
{
struct TNode* parent = nullptr;
struct TNode* left = nullptr;
struct TNode* right = nullptr;
std::string* s_Name;
int s_Id;
} TNode;
|
there are issues, for example:
1 2 3 4 5
|
class TBST
{
public:
TBST();
TNode *root;
|
TBST::TBST() is empty, so
root is left uninitialised (a dangling pointer).
So, if I have understood correctly, you want to store some students’ data (name and id) and then perform on them operations that your going to read from a file. To achieve that, you have written your own container and than a number of functions to turn the operations you read on that file into something your container can understand.
I think you’ve done a great job, but in my opinion it is a big, hard to maintain and to reuse code.
If you are doing that to prove yourself or because you’re required to do it, that’s great; if you want to use your code for something practical… I might sound terribly harsh (sorry for that), but, as a C++ beginner, I’d suggest reconsidering the project from scratch.
Anyway, to get better help, in the future you could consider providing also an example of what your ‘operations file’ looks like.
Happy coding.