Click here to Skip to main content
15,845,273 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
ELMAGLAYA17-Jan-17 20:33
ELMAGLAYA17-Jan-17 20:33 
AnswerRe: Why my fetch row method just repeats the first record multiple times (same count as my number of fields in the table) Pin
COBOLdinosaur27-Feb-17 9:33
COBOLdinosaur27-Feb-17 9:33 
QuestionI do not know why after entering the second number for the second time, it always gives the same result Pin
Member 1294604611-Jan-17 18:35
Member 1294604611-Jan-17 18:35 
AnswerRe: I do not know why after entering the second number for the second time, it always gives the same result Pin
ZurdoDev13-Jan-17 7:08
professionalZurdoDev13-Jan-17 7:08 
QuestionI do not know why after entering the second number for the second time, it always gives the same result Pin
Member 1294604611-Jan-17 18:35
Member 1294604611-Jan-17 18:35 
Buenas el caso es este:


[IMG]https://s27.postimg.org/4wo7d1e7n/ejer.png[/IMG]

code:[url]http://pastebin.com/tPN44966[/url]
[code]package practica;

public class adivinar2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int numeroAdivinar;
		int numeroComparar;
		 short contador;
		 int cifrasAdivinar= 0; 
		 int bandera=0;
		 int nDesAdivinar;
		 int nDesComparar;
		 int digitoAdivinar;
		 int digitoComparar;
		
		System.out.println("Introduzca el primer numero");
		numeroAdivinar=Leer.datoInt();
		
		for ( contador=1 ; contador<=10; contador++){
			
			
			
			System.out.println("Introduzca el segundo numero");
			numeroComparar=Leer.datoInt();
			
			if(numeroAdivinar==numeroComparar){
				
           	 contador=10;
           	 bandera=1;
           	 
            }else{
            	
            	nDesAdivinar=numeroAdivinar;
            	nDesComparar=numeroComparar;
            	
            	while(  nDesAdivinar!=0){   
				
            		nDesAdivinar = nDesAdivinar/10;
            				digitoAdivinar= nDesAdivinar%10; 
            		nDesComparar = nDesComparar/10;
            				digitoComparar=nDesComparar%10;
            		if(digitoAdivinar==digitoComparar){
            			cifrasAdivinar=cifrasAdivinar+1;
            		}
				      
            	}cifrasAdivinar=cifrasAdivinar-1;
            	System.out.println("Has introducido un total de: "+cifrasAdivinar+" dígitos");
		
		}
            	
		}
		if(bandera==1){
			System.out.println("Has acertado todas las cifras");
			
		}else{
			System.out.println("Se te acabaron las oportunidades");
		}
		}
			
		
         
        
       
          
	}
	[/code]

prblema:[spoiler][code]Introduzca el primer numero123
Introduzca el segundo numero
153
Has introducido un total de: 2 dígitos
Introduzca el segundo numero
223
Has introducido un total de: 2 dígitos
Introduzca el segundo numero
555
Has introducido un total de: 2 dígitos
Introduzca el segundo numero
153
Has introducido un total de: 2 dígitos
Introduzca el segundo numero
123
Has acertado todas las cifras
[/code][/spoiler]




Parece que cuando vuelve a partir de la segunda vez, ya se desloquece


[spoiler][code]
Introduzca el primer numero
123456789
Introduzca el segundo numero
123456779
Has introducido un total de: 8 dígitos
Introduzca el segundo numero
123456779
Has introducido un total de: 8 dígitos
Introduzca el segundo numero
123456669
Has introducido un total de: 8 dígitos
Introduzca el segundo numero
123466669
Has introducido un total de: 8 dígitos
Introduzca el segundo numero[/code][/spoiler]

AnswerRe: I do not know why after entering the second number for the second time, it always gives the same result Pin
ZurdoDev13-Jan-17 7:08
professionalZurdoDev13-Jan-17 7:08 
QuestionHTML fo uploading image file Pin
FilippoCSM10-Jan-17 4:51
FilippoCSM10-Jan-17 4:51 
AnswerRe: HTML fo uploading image file Pin
Nathan Minier10-Jan-17 7:43
professionalNathan Minier10-Jan-17 7:43 
GeneralRe: HTML fo uploading image file Pin
FilippoCSM10-Jan-17 10:20
FilippoCSM10-Jan-17 10:20 
QuestionWCF Service consumed through browser but NOT with WCFClient Pin
MrKBA5-Jan-17 21:17
MrKBA5-Jan-17 21:17 
AnswerRe: WCF Service consumed through browser but NOT with WCFClient Pin
Nathan Minier6-Jan-17 2:25
professionalNathan Minier6-Jan-17 2:25 
GeneralRe: WCF Service consumed through browser but NOT with WCFClient Pin
MrKBA6-Jan-17 2:57
MrKBA6-Jan-17 2:57 
GeneralRe: WCF Service consumed through browser but NOT with WCFClient Pin
Nathan Minier6-Jan-17 4:50
professionalNathan Minier6-Jan-17 4:50 
GeneralRe: WCF Service consumed through browser but NOT with WCFClient Pin
MrKBA6-Jan-17 5:45
MrKBA6-Jan-17 5:45 
QuestionSignalR on IIS Not Working Pin
Kevin Marois5-Jan-17 14:08
professionalKevin Marois5-Jan-17 14:08 
AnswerRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 6:50
professionalZurdoDev6-Jan-17 6:50 
GeneralRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 6:51
professionalKevin Marois6-Jan-17 6:51 
GeneralRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 6:54
professionalZurdoDev6-Jan-17 6:54 
GeneralRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 7:04
professionalKevin Marois6-Jan-17 7:04 
GeneralRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 7:57
professionalZurdoDev6-Jan-17 7:57 
GeneralRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 7:05
professionalKevin Marois6-Jan-17 7:05 
QuestionRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 7:58
professionalZurdoDev6-Jan-17 7:58 
AnswerRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 8:02
professionalKevin Marois6-Jan-17 8:02 
GeneralRe: SignalR on IIS Not Working Pin
ZurdoDev6-Jan-17 8:10
professionalZurdoDev6-Jan-17 8:10 
GeneralRe: SignalR on IIS Not Working Pin
Kevin Marois6-Jan-17 8:34
professionalKevin Marois6-Jan-17 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.