AYUDA POR FAVOR
hola, me pueden ayudar con este codigo
estoy tratando de leer un vector cada 5 lineas pero solo me leer la primera, aaqui dejo el codigo sime pueden ayudar
import java.io.*;
import java.lang.*;
import java.util.*;
public class club {
/** Creates a new instance of club */
public club() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
String[] vectfrase=new String[90000];
String[] veclinea=new String[90000];
String[] vectfrase1=new String[90000];
String[] vectfrase2=new String[90000];
String[] vectfrase3=new String[90000];
String[] vectfrase4=new String[90000];
String text = null;
int n= 0;
BufferedReader br = new BufferedReader(new FileReader("C:\Datos2.txt"));
while ((text = br.readLine()) != null){
veclinea[n]= text;
// System.out.println(veclinea[n]);
n++;
}
try{
// System.out.println(n);
for(int i = 0; i <= n; i=+5){
System.out.println(veclinea[i]);
for(int j = 0; j <= n*2; j++){
vectfrase=veclinea[i].split(" ");
System.out.println(vectfrase[j]);
}
}
}catch(java.lang.ArrayIndexOutOfBoundsException yj){}
// TODO code application logic here
}
}
gracias
estoy tratando de leer un vector cada 5 lineas pero solo me leer la primera, aaqui dejo el codigo sime pueden ayudar
import java.io.*;
import java.lang.*;
import java.util.*;
public class club {
/** Creates a new instance of club */
public club() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
String[] vectfrase=new String[90000];
String[] veclinea=new String[90000];
String[] vectfrase1=new String[90000];
String[] vectfrase2=new String[90000];
String[] vectfrase3=new String[90000];
String[] vectfrase4=new String[90000];
String text = null;
int n= 0;
BufferedReader br = new BufferedReader(new FileReader("C:\Datos2.txt"));
while ((text = br.readLine()) != null){
veclinea[n]= text;
// System.out.println(veclinea[n]);
n++;
}
try{
// System.out.println(n);
for(int i = 0; i <= n; i=+5){
System.out.println(veclinea[i]);
for(int j = 0; j <= n*2; j++){
vectfrase=veclinea[i].split(" ");
System.out.println(vectfrase[j]);
}
}
}catch(java.lang.ArrayIndexOutOfBoundsException yj){}
// TODO code application logic here
}
}
gracias
Hola Amanda me atrevi a hacer unas correscciones a tu código y ya probado quiero decirte que si funciona a qui esta:
import java.io.*;
import java.util.*;
public class club {
public static void main(String[] args) throws IOException {
String[] vectfrase=new String[90000];
String[] veclinea=new String[90000];
String[] vectfrase1=new String[90000];
String[] vectfrase2=new String[90000];
String[] vectfrase3=new String[90000];
String[] vectfrase4=new String[90000];
String text = null;
int n= 0;
BufferedReader br = new BufferedReader(new FileReader("C:\Datos2.txt"));
do {
text = br.readLine();
veclinea[n]= text;
n++;
}while (n<5);
for(n=0;n<5;System.out.println(veclinea[n++]));
}
}
Si sigue sin funcianar mandame un correo para poderte ayudar por que en mi maquina si funciono
import java.io.*;
import java.util.*;
public class club {
public static void main(String[] args) throws IOException {
String[] vectfrase=new String[90000];
String[] veclinea=new String[90000];
String[] vectfrase1=new String[90000];
String[] vectfrase2=new String[90000];
String[] vectfrase3=new String[90000];
String[] vectfrase4=new String[90000];
String text = null;
int n= 0;
BufferedReader br = new BufferedReader(new FileReader("C:\Datos2.txt"));
do {
text = br.readLine();
veclinea[n]= text;
n++;
}while (n<5);
for(n=0;n<5;System.out.println(veclinea[n++]));
}
}
Si sigue sin funcianar mandame un correo para poderte ayudar por que en mi maquina si funciono
