C++ sort array of strings

后端 未结 6 1876
渐次进展
渐次进展 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 15:57

    Here is C++ another way to sort array of string without using .

    #include 
    #include 
    
    using namespace std;
    
    int main() {
        string WordArray[] = {"AA","DD","CC","BB","ZZ","NN"};
        sort(begin(WordArray), end(WordArray));  /*Sort the Array*/
        for(auto& Word: WordArray){
           cout<

提交回复
热议问题