finished doing lab2 in wrong variable type

This commit is contained in:
dymik739 2023-03-18 11:18:59 +02:00
parent 00fba12eb2
commit 3f15c4c724
3 changed files with 20 additions and 5 deletions

View File

@ -64,16 +64,29 @@ public class Main {
System.exit(1);
}
}
int[][] matrix = loadMatrixFromFile(matrix_file);
// loading matrix data from file
int[][] raw_m = loadMatrixFromFile(matrix_file);
// creating original matrix object
System.out.println("Original matrix:");
Matrix m = new Matrix();
m.init(raw_m);
// transposing
m.transpose();
System.out.println("\nTransposed matrix:");
m.print();
// avg
System.out.println("\nAverage value is " + m.getAvg());
}
private static void fetchResource(String remote_url, String output_filename) {
try {
BufferedInputStream in = new BufferedInputStream(new URL(remote_url).openStream());
FileOutputStream fileOutputStream = new FileOutputStream(output_filename);
byte dataBuffer[] = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
@ -138,11 +151,11 @@ public class Main {
}
for (int j = 0; j < baked_matrix_lines.get(i).length; j++) {
System.out.print(baked_matrix_lines.get(i)[j] + " ");
//System.out.print(baked_matrix_lines.get(i)[j] + " ");
baked_matrix[i][j] = Integer.parseInt(baked_matrix_lines.get(i)[j]);
}
System.out.print("\n");
//System.out.print("\n");
}
return baked_matrix;

View File

@ -0,0 +1,2 @@
import random
print("Content-Type: text/plain\n\n" + "\n".join([" ".join(list(map(str, [round((random.random()-0.5)*200, 4) for i in range(7)]))) for i in range(7)]))