Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define MAX 100
- using namespace std;
- int main(int argc, char *argv[])
- {
- int n, swap;
- int vet[MAX];
- cout << "Inserire n vet_(max = 100): " << endl;
- do{
- cin >> n;
- }while(n > 100);
- for (int i = 0; i < n; i++){
- cout << "Vet" << i + 1 << " ";
- cin >> vet[i];
- }
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- if(vet[j] < vet [i]){
- swap = vet[i];
- vet[i] = vet[j];
- vet[j] = swap;
- }
- }
- }
- cout << endl;
- for (int i = 0; i < n; i++){
- cout << vet[i] << " ";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment