Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /*
- * File: main.cpp
- * Author: roman
- *
- * Created on October 20, 2019, 10:53 AM
- */
- #include <cstdlib>
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <stdlib.h>
- #include <time.h>
- #include <cmath>
- #include <complex>
- #include <limits>
- #include <algorithm>
- using namespace std;
- void sort(int * tab, int size){
- int i,j,x;
- for(i=1; i<size; i++){
- for(j=size; j>=i; j--){
- if(tab[j-1] > tab[j]){
- swap(tab[j-1], tab[j]);
- }
- }
- }
- }
- int main(int argc, char** argv) {
- int tab[10] {5, 6, 4, -3, 5, 8, 3, 2, 5, 20};
- int size = sizeof(tab)/sizeof(tab[0]);
- sort(tab, size);
- for(int i = 0; i<size; i++){
- cout<<tab[i]<<" ";
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement