头文件algorithm的函数使用

//不断更新

algorithm的头文件

sort

reverse

//reverse可以将一个数组反转
a[10] = {
    
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
reverse(a, a + 10);
for (int i = 0; i < 10; i ++) cout << a[i] << ' ';
/*
输出结果:
9 8 7 6 5 4 3 2 1 0
*/

猜你喜欢

转载自blog.csdn.net/qq_45914558/article/details/108425694