Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void wyswietl (double T[], int n ){
- for (int i=0;i<n;i++) cout<<T[i]<<"\t";
- cout<<endl;
- }
- void sortuj (double T[], int n){
- double pom;
- int k;
- for (int i=1;i<n;i++){
- pom = T[i];
- k = i-1;
- for (k; k>=0&&T[k]>pom; k--){
- T[k+1]=T[k];
- }
- T[k+1] = pom;
- }
- }
- main(){
- double T[8] = {7,2,1,3,4,6,5,8};
- int n =8;
- cout<<"Przed sortowaniem:\t";
- wyswietl(T,n);
- sortuj(T,n);
- cout<<"Po sortowaniu:\t";
- wyswietl(T,n);
- return 0;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement