import java.sql.SQLOutput;
public class PJJJeden {
public static void selSort(int[] arr) {
for (int i = 0; i < arr.length - 1; ++i) {
int indMin = i;
for (int j = i; j < arr.length; ++j)
if (arr[j] < arr[indMin]) indMin = j;
int temp = arr[i];
arr[i] = arr[indMin];
arr[indMin] = temp;
}
}
public static void printRows(int[][] arr) {
for(int i =0; i<arr.length;i++){
for(int j = 0; j<arr[i].length; j++)
System.out.print(arr[i][j] + " ");
System.out.println();
}
}
public static void main (String[] args) {
int[][] a = { {3,2,6,1,3,5,6,1,3},
{3,1,2,1,5,7,2},
{8,9,2,1} };
System.out.println("Before:");
//printArr2D(a);
printRows(a);
System.out.println("After:");
printArr2D(a);
int[][] b = { {3,2,6,1,6},
{7,1,2,1,5},
{5,3,1,8,7},
{8,9,2,7,1} };
System.out.println("Now columns\nBefore:");
printArr2D(b);
sortCols(b);
System.out.println("After:");
printArr2D(b);
}
private static void sortCols(int[][] b) {
}
private static void printArr2D(int[][] a) {
}
//Zadanie 2
private static void isSquare(double[][] tab) {
int count = 0;
int count1 = 0;
for(int i = 0; i<tab.length; i++ ){
count++;
for(int j = 0; j <tab.length; j++){
count1++
System.out.println(tab[i][j]);
}
}
if(count == count1){
System.out.println("isSquare");
}
else{
System.out.println("not square");
}
}
private static void isRectangular(double[][] tab) {
int count = 0;
int count1 = 0;
for(int i = 0; i<tab.length; i++ ){
count++;
for(int j = 0; j <tab.length; j++){
count1++
System.out.println(tab[i][j]);
}
}
if(count == count1){
System.out.println("isSquare");
}
else{
System.out.println("not square");
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter