English 中文(简体)
2. 采用双向储存树木
原标题:Error with binary storage tree fstream

目前,Im公司有一个项目,是我用千名名字的硬拷贝文档,并将其植入双双管储存树。 Hit error 脚石

error C2248:  std::basic_ios<_Elem,_Traits>::basic_ios  : cannot access private member declared in class  std::basic_ios<_Elem,_Traits>     c:program files (x86)microsoft visual studio 10.0vcincludefstream  1116

我希望有人能够帮助我解释问题的根源。

预先感谢。

jo

edit:

BinaryTreeStorage::BinaryTreeStorage(void) : root(NULL)
{

}

BinaryTreeStorage::~BinaryTreeStorage(void)
{

}

void BinaryTreeStorage::insert(string &input, TreeNode *&root)
{
if(root != NULL)
{
    root -> name = input;
    root -> left = NULL;
    root -> right = NULL;
}

else if (input < root -> name)
{
    insert(input, root -> left);
}
else
{
    insert(input, root -> left);
}   
}

string BinaryTreeStorage:: writeToTree(TreeNode *&root)
{
if(root ->left != NULL)
{
    writeToTree(root ->left);
}
return root->name;
if (root->right != NULL)
{
    writeToTree(root);
}
}

void BinaryTreeStorage::write(ofstream nameOut)
{
cout << "Writing out bst names" << endl;
writeToTree(root);
}

void BinaryTreeStorage::read(ifstream& nameIn)
{
cout<< "Reading in bst" << endl;
string name;

for (int i = 0; i < numberOfNames; i++)
{
    nameIn >> name;
    insert (name, root);
}
}
问题回答

www.un.org/Depts/DGACM/index_spanish.htm 页: 1 查阅。 那么,你从来都不见use。 <代码>名称 摘录在身体中的功能论点,因此,不能完全放弃:

void BinaryTreeStorage::write()
{
    cout << "Writing out bst names" << endl;
    writeToTree(root);
}




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签