Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package nowyprogram;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- /**
- *
- * @author student
- */
- public class NowyProgram {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws FileNotFoundException {
- File file = new File("D:\\v.txt");
- Scanner in = new Scanner(file);
- Scanner in2 = new Scanner(file);
- double [][] tab;
- int i=0;
- while(in2.hasNext()){
- String zdanie2 = in2.nextLine();
- if (zdanie2.startsWith("v "))
- i++;
- }
- tab = new double [i][3];
- i=0;
- while (in.hasNext()){
- String zdanie = in.nextLine();
- if (zdanie.startsWith("v ")){
- String [] words = zdanie.split(" ");
- tab[i][0]=Double.parseDouble(words[1]);
- tab[i][1]=Double.parseDouble(words[2]);
- tab[i][2]=Double.parseDouble(words[3]);
- i++;
- //String wyraz = in.
- //System.out.println(zdanie);
- }
- }
- for (i=0;i<tab.length;i++){
- System.out.println(tab[i][0]+" "+ tab[i][1]+" "+tab[i][2]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement