我想在C++中做一個並行qsort。我有數字排序好,我想要一個平行的二維字符數組向上或向下移動它的數字。這是我迄今爲止所擁有的。使用指針的Qsort並行陣列
int compare (const void * a, const void * b)
{
//this is for qsort
return (*(int*)b - *(int*)a);
}
void sort_scores(char** myArray, int *votes)
{
qsort ((myArray, votes), 5, sizeof(int), compare);
}
我對數字進行了排序,但缺少移動字符一次,我似乎無法得到這個工作。任何幫助深表感謝。
你介意描述你正在解決什麼問題嗎?聽起來你可以使用'std :: map'或者一些結構的向量。 – jrok 2013-02-10 11:06:36