Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.io.File;
- public class zad4 {
- public static double []sort(double []tab)
- {
- boolean czyZmiana = true;
- double pom;
- while(czyZmiana)
- {
- czyZmiana = false;
- for(int i = 1; i<tab.length; i++)
- {
- if(tab[i-1]>tab[i])
- {
- pom = tab[i];
- tab[i] = tab[i-1];
- tab[i-1] = pom;
- czyZmiana = true;
- }
- }
- }
- return tab;
- }
- public static void show(double []tab)
- {
- for(int i = 0; i<tab.length; i++)
- {
- System.out.println(tab[i]);
- }
- }
- public static void main(String[] args) {
- double []t = {1.0,5.0,6.0,8.0,3.0,5.0, 10.00, 4.5};
- t = sort(t);
- File plik = new File("dane.txt");
- Scanner wej = new Scanner(plik);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement