Created
May 21, 2019 22:12
-
-
Save Thiago4532/1132967c306bc51146d47580f938ad02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> // Biblioteca que contem a estrutura vector | |
#include <algorithm> // Biblioteca do sort | |
using namespace std; | |
int main() { | |
vector<int> v; // Declaracao de um vector do tipo int | |
v.push_back(3); // Insiro o elemento 3 no final do vetor | |
v.push_back(1); // Insiro o elemento 1 no final do vetor | |
v.push_back(5); // Insiro o elemento 5 no final do vetor | |
v.push_back(7); // Insiro o elemento 7 no final do vetor | |
// v = {3, 1, 5, 7} | |
sort(v.begin(), v.end()); | |
// v = {1, 3, 5, 7} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment