Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 我不知道';我不知道getHighScore函数为什么不读取文件 程序设计语言是C++。 此代码在文本文件列表中查找得分最高的人。 我的代码有问题吗? 我认为它没有任何问题。它不读取文件。。。请帮帮我。该文件依次具有名称和分数 #include &_File_Io - Fatal编程技术网

File 我不知道';我不知道getHighScore函数为什么不读取文件 程序设计语言是C++。 此代码在文本文件列表中查找得分最高的人。 我的代码有问题吗? 我认为它没有任何问题。它不读取文件。。。请帮帮我。该文件依次具有名称和分数 #include &

File 我不知道';我不知道getHighScore函数为什么不读取文件 程序设计语言是C++。 此代码在文本文件列表中查找得分最高的人。 我的代码有问题吗? 我认为它没有任何问题。它不读取文件。。。请帮帮我。该文件依次具有名称和分数 #include &,file,io,File,Io,我不知道';我不知道getHighScore函数为什么不读取文件 程序设计语言是C++。 此代码在文本文件列表中查找得分最高的人。 我的代码有问题吗? 我认为它没有任何问题。它不读取文件。。。请帮帮我。该文件依次具有名称和分数 #include <iostream> #include <fstream> #include <string> using namespace std; void getHighScore(string& name,

我不知道';我不知道getHighScore函数为什么不读取文件

程序设计语言是C++。 此代码在文本文件列表中查找得分最高的人。 我的代码有问题吗? 我认为它没有任何问题。它不读取文件。。。请帮帮我。该文件依次具有名称和分数

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

void getHighScore(string& name, int& score)
{
score = 0;
string hname;
int hscore;

ifstream inStream;
inStream.open("scores.txt");
if (inStream.is_open()) cout << "yes"; else cout << "no";

while (inStream >> hname)
{
    inStream >> hscore;
    cout << hname << " " << hscore << "\n";
    if (hscore > score) {
        score = hscore;
        name = hname;
    }
}
inStream.close();
}
int main()
{
string name;
int score;
getHighScore(name, score);

cout << name << " " << score;
return 0;
}
#包括
#包括
#包括
使用名称空间std;
void getHighScore(字符串和名称、整数和分数)
{
得分=0;
我;
int-hscore;
流内流;
inStream.open(“scores.txt”);
如果(流内是开放的())无法打开)
{
流内>>hscore;
库特