运行 ❯
获取
您自己的
网站
×
更改方向
更改主题,深色/浅色
转到 Spaces
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { // Create a vector called numbers that will store integers vector<int> numbers = {1, 7, 3, 5, 9, 2}; // Sort numbers numerically in reverse order sort(numbers.rbegin(), numbers.rend()); // Print numbers for (int num : numbers) { cout << num << "\n"; } return 0; }
9
7
5
3
2
1