※ 引述《cchou0114 (嘻嘻)》之銘言:
: 如題
: 我想要將字串排序
: 例如有3個字串
: 分別存在一個字串陣列中
: string word[];
: word[0]="Hello";
: word[1]="World";
: word[2]="Bye";
: 要怎麼把他依照字首順序排序呢
: 變成這樣
: word[0]="Bye";
: word[1]="Hello";
: word[2]="World";
: 求各位大大給個意見或提示
: 謝謝!
#include <algorithm>
sort(word,word+3, [](auto a, auto b){
return a[0] > b[0];
});