C++ sort array of strings

后端 未结 6 1898
渐次进展
渐次进展 2021-01-01 15:28

I am trying to sort an array of strings, but it\'s not sorting anything.... what am I doing wrong?

string namesS[MAX_NAMES];

int compare (const void * a, co         


        
6条回答
  •  忘掉有多难
    2021-01-01 16:07

    This is C++, not C. Sorting an array of strings is easy.

    #include 
    #include 
    #include 
    
    std::vector stringarray;
    std::sort(stringarray.begin(), stringarray.end());
    

提交回复
热议问题