Skip to content

Instantly share code, notes, and snippets.

@tjohns
Created June 27, 2016 16:22
Show Gist options
  • Save tjohns/60786d942a269b7c8b7e5a9cfb93d28d to your computer and use it in GitHub Desktop.
Save tjohns/60786d942a269b7c8b7e5a9cfb93d28d to your computer and use it in GitHub Desktop.
C++ sorting example
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int data[] = {2,4,3,5,1};
cout << "Input: " << data[0] << data[1] << data[2] << data[3] << data[4] << endl;
sort(begin(data), end(data));
cout << "Output: " << data[0] << data[1] << data[2] << data[3] << data[4] << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment