2022
08-16
08-16
带你了解C++中的sort函数
目录sort()char型数组char型数组总结sort()使用方法:sort(首元素地址(必填),尾元素地址的下一个地址(必填),比较函数(非必填))必须加上头文件:#include<algorithm>和usingnamespacestd;举个栗子:#include<stdio.h>#include<algorithm>usingnamespacestd;intmain(){intbook[5]={5,4,2,8,7};sort(book,book+5);inti;for(i=0;i<5;i++){printf("%d",book[i]);}return0;}char型数组#include<stdio....
继续阅读 >