C++ Coding Practice
Practice typing real code syntax, including brackets, punctuation, and indentation. Snippets are for typing practice only and are never executed.
Sort a vector
Type the code exactly. Tab inserts four spaces. Code is not executed.
Progress: 0%
Current mismatches: 0
#include <algorithm>
#include <iostream>
#include <vector>
int main() {
std::vector<int> values{9, 2, 7, 1, 5};
std::sort(values.begin(), values.end());
for (int value : values) {
std::cout << value << " ";
}
std::cout << '\n';
return 0;
}
Type the code exactly, including spaces and indentation.