jeudi 5 mars 2015

How do I take 4 arguments from a text file and build a binary tree out of it?


This problem has been plaguing me for while and the searches I've made for it don't really answer my question completely


I want to take a file, read it and take 4 words from it, those 4 words will be put as arguments into a function that builds a tree out of it. This function will repeat taking 4 words until it reaches end of file. I think I have an idea of how to do it but I'm not really sure where to go after a certain point.


heres my current attempt at it



if (myFile.is_open());
{
while (!myFile.eof())
{
while (getline(myFile, line, ','))
{
message.find(',');

message.substr();

for (int count = 1; count <= 4; count++)
{
// so right here I think I have the right idea but I don't know where to go from here
}

}
}
}


For the function I believe I start by claiming a temp node as a root and then build from there


Here's and example of what I want to go into the function: 1,Shawshank Redemption,1994,45


it would compare the item by name.




Aucun commentaire:

Enregistrer un commentaire