Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Ejercicio9;
- import java.io.IOException;
- public class Insercion {
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- int i=0;
- char [] caracteres=new char [20];
- char num;
- char resp=' ';
- char carac,n;
- do{
- System.out.println("Desea introducir otro caracter?");
- carac=Consola.leeChar();
- i++;
- System.out.print("Otro caracter");
- resp=Consola.leeChar();
- }
- while(i <100 && resp=='S');
- //caracteres[i]=caracteres[i+1];
- System.out.println("Introduzca numero");
- num=Consola.leeChar();
- System.out.println("Introduzca posicion");
- n=Consola.leeChar();
- char g=(char) caracteres.length;
- for ( i=(g-1);i>=(n-1);i--){
- caracteres[i+1]=caracteres[i];
- caracteres[n-1]=num;
- g++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment