Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.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
String 如何对具有关联整数的字符串(在我的示例中是播放器)进行排序(我对它们有一个等级)?_String_Sorting_Integer - Fatal编程技术网

String 如何对具有关联整数的字符串(在我的示例中是播放器)进行排序(我对它们有一个等级)?

String 如何对具有关联整数的字符串(在我的示例中是播放器)进行排序(我对它们有一个等级)?,string,sorting,integer,String,Sorting,Integer,我有不同的球员,这是字符串评级。我可以排序的评级,但我不能保持与评级的球员。我应该使用什么数据结构。。。?我尝试了一个链接列表,但没有成功。也许是一个哈希表 以下是我正在使用的主要功能: playerData::playerData(string fileInput){ //header.next = &trailer; trailer.prev = &header; ifstream file(fileInput); if (file.is_open()) { whi

我有不同的球员,这是字符串评级。我可以排序的评级,但我不能保持与评级的球员。我应该使用什么数据结构。。。?我尝试了一个链接列表,但没有成功。也许是一个哈希表

以下是我正在使用的主要功能:

playerData::playerData(string fileInput){
//header.next = &trailer;
trailer.prev = &header;
ifstream file(fileInput);
 if (file.is_open())
{
    while(file.good()){
        getline(file, player, ',');
        //file >> name;
        file >> position;
        file >> min;
        file >> fgPercent;
        file >> ftPercent;
        file >> threePM;
        file >> rebound;
        file >> assist;
        file >> steals;
        file >> blocks;
        file >> TOPG;
        file >> points;
        /*
        cout << player <<  "; Position: " << position << "; MPG: " << min << "; FG%: " << fgPercent << 
        "; FT%: " << ftPercent << "; 3PM: " << threePM << "; RPG: " << rebound << "; APG: " << assist << 
        "; STPG: " << steals << "; BLKPG: " << blocks << "; TOPG: " << TOPG << "; PTS: " << points;
        */
        cout << player <<  "; Position: " << position;
        rating = (fgPercent * 30) + (ftPercent * 18) + (threePM * 15) + (rebound * 3) + (assist * 2) + (steals * 10) + (blocks * 15) - (TOPG * 3.5) + (points * 0.7);
        cout << "; RATING: " << rating;

        //if(header.next == &trailer){
            
        //}
    }
}
else
{
    cout << "Error opening file" << endl;
}
cout << endl;
playerData::playerData(字符串文件输入){
//header.next=&trail;
trailer.prev=&header;
ifstream文件(fileInput);
if(file.is_open())
{
while(file.good()){
getline(文件,播放器,,);
//文件>>名称;
文件>>位置;
文件>>分钟;
文件>>FG百分比;
文件>>ftPercent;
文件>>下午三点;
文件>>回弹;
文件>>辅助;
文件>>偷窃;
文件>>块;
文件>>TOPG;
文件>>点;
/*

Cout请把你目前所尝试的语言、你正在使用的语言和一个最小的可重复的例子都做了一些编辑。我用C++编写代码。