C++ Can';无法在Visual Studio C+中读取我的文本文件+;

C++ Can';无法在Visual Studio C+中读取我的文本文件+;,c++,visual-studio-2010,text,binary-tree,C++,Visual Studio 2010,Text,Binary Tree,所以我有一个compsci课程的实验室,教授和助教使用Eclipse,但我无法正常运行,所以我尝试了Visual Studio。我遇到的问题是,我无法让我的程序读取我想要的文本文件,这样它就可以执行它需要的操作 以下是我的代码: struct wordpair { string key; string following; }; int compare(wordpair a, wordpair b) { if (a.key < b.key) return -1; if (a.key =

所以我有一个compsci课程的实验室,教授和助教使用Eclipse,但我无法正常运行,所以我尝试了Visual Studio。我遇到的问题是,我无法让我的程序读取我想要的文本文件,这样它就可以执行它需要的操作

以下是我的代码:

struct wordpair { string key; string following; };

int compare(wordpair a, wordpair b) {
if (a.key  < b.key) return -1;
if (a.key == b.key) return  0;
if (a.key  > b.key) return  1;
}

int main() {
ArrayDeque<string> A;
Treap1<wordpair> bst;
string k, l;

ifstream textstream("c:\\Users\\Jay\\Documents\\textfile.txt");
int t = clock();
textstream >> k;
A.add(0, k);
// insert wordpairs
while (textstream >> l) {
    wordpair w;
    w.key = k; w.following = l;
    bst.add(w);
    k = l;
    A.add(0, k);
}
// do some searches
for (int i = 0; i < 3*A.size(); ++i){
    wordpair w;
    w.key = A.get(rand()%A.size());
    bst.find(w);
}
cout << "time for " << bst.size() << " adds and " << 3*A.size() << " searches is " << clock()-t << endl;

char c;
cin >> c;
struct wordpair{string key;string following;};
int比较(字对a、字对b){
如果(a.keyb键)返回1;
}
int main(){
ArrayDeque A;
Treap1 bst;
字符串k,l;
ifstream textstream(“c:\\Users\\Jay\\Documents\\textfile.txt”);
int t=时钟();
textstream>>k;
A.添加(0,k);
//插入字对
而(文本流>>l){
字对w;
w、 键=k;w.跟随=l;
bst.add(w);
k=l;
A.添加(0,k);
}
//做一些搜索
对于(int i=0;i<3*A.size();++i){
字对w;
w、 key=A.get(rand()%A.size());
bst.find(w);
}

你能不能更具体地说明你看到的错误。一个模糊的问题投3票?要么是袜子木偶,要么是人们很早就开始了他们的饮酒游戏。