Incrementation de an
zmandar
-
zmandar -
zmandar -
Bonjour,
svp ,pourquoi ce programme n 'incrémente pas an dans le fichier
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package projet;
import java.io.*;
/**
*
* @author Administrateur
*/
public class fichierbulle3 {
public static void fichier (int taille, int cn,int an) throws IOException
{
File fichier = new File("C:\\tri-bulle-antitri.txt") ;
BufferedWriter out = new BufferedWriter(new FileWriter(fichier, true));
String c = String.valueOf(cn);
String h = String.valueOf(an);
String t = String.valueOf(taille);
out.write(t+" "+c+" "+h);
out.newLine();
out.close() ;
}
public static int[] antitri(int T[],int taille)
{
for (int i=taille-1; i>=0;i--)
{ T[i]= i+1;}
return(T);}
public static int[] tribulle(int [] T ,int taille) throws IOException
{
int inter;
int cn=0;
int an =0;
for(int h=0; h<taille; h=h+1)
{
for(int j=0; j<taille-h-1 ; j=j+1)
{
cn++;
if(T[j]>T[j+1])
{
an++;
inter=T[j];
T[j]=T[j+1];
T[j+1]=inter;
}
}
}
for(int f=0;f<taille;f++)
{
System.out.print(T[f]+" ");
}
System.out.print("\n");
fichier (taille, cn,an);
return T ;
}
public static void main (String []args) throws IOException
{
int i ;
for (i=2;i<=512;i++){
int []T=new int [i];
antitri( T,i );
tribulle(T,i);}
}
}
svp ,pourquoi ce programme n 'incrémente pas an dans le fichier
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package projet;
import java.io.*;
/**
*
* @author Administrateur
*/
public class fichierbulle3 {
public static void fichier (int taille, int cn,int an) throws IOException
{
File fichier = new File("C:\\tri-bulle-antitri.txt") ;
BufferedWriter out = new BufferedWriter(new FileWriter(fichier, true));
String c = String.valueOf(cn);
String h = String.valueOf(an);
String t = String.valueOf(taille);
out.write(t+" "+c+" "+h);
out.newLine();
out.close() ;
}
public static int[] antitri(int T[],int taille)
{
for (int i=taille-1; i>=0;i--)
{ T[i]= i+1;}
return(T);}
public static int[] tribulle(int [] T ,int taille) throws IOException
{
int inter;
int cn=0;
int an =0;
for(int h=0; h<taille; h=h+1)
{
for(int j=0; j<taille-h-1 ; j=j+1)
{
cn++;
if(T[j]>T[j+1])
{
an++;
inter=T[j];
T[j]=T[j+1];
T[j+1]=inter;
}
}
}
for(int f=0;f<taille;f++)
{
System.out.print(T[f]+" ");
}
System.out.print("\n");
fichier (taille, cn,an);
return T ;
}
public static void main (String []args) throws IOException
{
int i ;
for (i=2;i<=512;i++){
int []T=new int [i];
antitri( T,i );
tribulle(T,i);}
}
}
A voir également:
- Incrementation de an
- Jour de l'an - Accueil - Messagerie instantanée
- 550 5.0.350 remote server returned an error -> 552 size limit exceeded ✓ - Forum Mail
- Un an et demi en chiffre ✓ - Forum LibreOffice / OpenOffice
- Erreur 550 5.1.0 ✓ - Forum Google Chrome
- MESSAGE REJETE Error 550 - Forum Réseaux sociaux