Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pkg311;
- import java.io.*;
- public class Main {
- public static void main(String[] args) {
- if (args.length != 2) {
- System.out.print("Неверное количество аргументов.");
- System.exit(0);
- }
- try {
- BufferedReader br = new BufferedReader(new FileReader(args[0]));
- String s;
- int m = Integer.parseInt(br.readLine());
- int n = Integer.parseInt(br.readLine());
- System.out.println(m);
- System.out.println(n);
- String[] numbers;
- double[][] arr = new double[m][n];
- for (int i = 0; i < m; i++) {
- s=br.readLine();
- numbers = s.split(" ");
- for (int j = 0; j < n; j++) {
- arr[i][j]=Integer.parseInt(numbers[j]);
- System.out.print(arr[i][j]+ " ");
- }
- System.out.println();
- }
- br.close();
- arr = Matrix.Func(arr,m,n);
- FileWriter writer = new FileWriter(args[1], false);
- for (int i = 0; i < m; i++)
- {
- for(int j =0; j<n; j++){
- writer.write(arr[i][j] + " ");
- System.out.print(arr[i][j] + " ");
- }
- System.out.println();
- }
- writer.close();
- } catch (FileNotFoundException e) {
- System.out.print("Файл не найден.");
- }
- catch (IOException e) {
- System.out.print("Ошибка ввода-ввывода.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement