Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package nowyprogram;
  7.  
  8. import java.io.File;
  9. import java.io.FileNotFoundException;
  10. import java.util.Scanner;
  11.  
  12. /**
  13. *
  14. * @author student
  15. */
  16. public class NowyProgram {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21. public static void main(String[] args) throws FileNotFoundException {
  22. File file = new File("D:\\v.txt");
  23. Scanner in = new Scanner(file);
  24. Scanner in2 = new Scanner(file);
  25. double [][] tab;
  26. int i=0;
  27. while(in2.hasNext()){
  28. String zdanie2 = in2.nextLine();
  29. if (zdanie2.startsWith("v "))
  30. i++;
  31. }
  32.  
  33. tab = new double [i][3];
  34. i=0;
  35. while (in.hasNext()){
  36. String zdanie = in.nextLine();
  37. if (zdanie.startsWith("v ")){
  38. String [] words = zdanie.split(" ");
  39. tab[i][0]=Double.parseDouble(words[1]);
  40. tab[i][1]=Double.parseDouble(words[2]);
  41. tab[i][2]=Double.parseDouble(words[3]);
  42. i++;
  43. //String wyraz = in.
  44. //System.out.println(zdanie);
  45. }
  46.  
  47. }
  48.  
  49.  
  50. for (i=0;i<tab.length;i++){
  51. System.out.println(tab[i][0]+" "+ tab[i][1]+" "+tab[i][2]);
  52. }
  53.  
  54.  
  55.  
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement