Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <conio.h>
- #include <vector>
- using namespace std;
- int main(int argc, char** argv)
- {
- int n;
- vector<int> v;
- cout << "Insira um numero e pressione ENTER, repita o processo quantas vezes quiser:" << endl;
- cout << "Insira o numero -1 para encerrar o processo e fazer a ordenacao dos numeros." << endl << endl;
- do
- {
- cin >> n;
- v.push_back(n);
- }
- while(n != -1);
- v.erase(v.end() - 1);
- sort(v.begin(), v.end());
- cout << endl;
- for(unsigned int i = 0; i < v.size(); ++i)
- {
- cout << "Item " << i << ": " << v.at(i) << endl;
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement