Szybki sposób na sortowanie napisów C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> #include <string.h> #include <algorithm> using namespace std;</algorithm></string.h></iostream> int main(int argc, char** argv) { //napis do posortowania: string s="abcabc"; char napis[256];//napis starego typu ANSI C strncpy(napis, s.c_str(),255); //kopiuj string to char * sort(napis, napis+s.length()); //sortuj cout << napis; return 0; } |