Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- size_t n;
- cout << "Vyvedi razmera na masiva: ";
- cin >> n;
- int*array = new int[n];
- int num[];
- for (int i = 0; i < n; i++){
- cout << "Vyvedi elementi [" << i << "]=";
- cin >> num[i];
- }
- cout << "\n Masivyt sled sortirane:\n | ";
- for (int temp, i = 0; i < n-1; i++){
- for (int j = i+1; j < n ; j++){
- if (num[i]>num[j]){
- temp = num[i];
- num[i] = num[j];
- num[j] = temp;
- }
- }
- }
- for (int i = 0; i < n; i++){
- cout << num[i] << " | ";
- }
- cout << endl;
- delete[] array;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement