Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- import java.util.Arrays;
- public class Determinant
- {
- public static void main(String args[]) throws IOException
- {
- int a [][] = new int[3][3];
- Scanner sf = new Scanner(new File("U:\\DataStructures\\Matrices\\Det3X3Data.in"));
- int maxIndx = -1;
- String text[] = new String[1000];
- while(sf.hasNext())
- {
- maxIndx++;
- text[maxIndx] = sf.nextLine( );
- }
- sf.close();
- int j = 0;
- int r1 = a.length;
- int c1 = a[0].length;
- do{
- if(text[j].equals("matrix")){
- j++;
- }
- else if(text[j].equals("row"))
- j++;
- else{
- if(matrix==1){
- while(!text[j].equals("matrix")){
- for(int k = 0; k<r1-1; k++){
- for(int i = 0; i<c1-1;i++){
- if(text[j].equals("row"))
- j++;
- else{
- int num = Integer.parseInt(text[j]);
- a[k][i]=num;
- System.out.println(a[k][i]);
- j++;
- }
- }
- }
- }
- }
- }
- }while(j<maxIndx);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment