Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- /* Obliczanie */
- int n = 8;
- double T[n] = {5,7,8,9,8,9,1,6};
- int w;
- for(int x = 0 ; x < n-1 ; x++){
- w = x;
- for(int i = x+1 ; i < n ; i++)
- {
- if(T[i] < T[w])
- {
- w = i;
- }
- }
- swap(T[w] , T[x]);
- }
- /*Wyprowadzenie */
- for(int j = 0; j < 8 ; j++){
- cout << T[j] << ", ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement