Ajout des TP

This commit is contained in:
Moncef STITI 2024-03-19 12:03:45 +01:00
parent 42bb92022a
commit e31e638c79
13 changed files with 47 additions and 28 deletions

View File

@ -7,4 +7,9 @@ int main(void){
printf(" -\"-\"- "); /*idem ici avec les guillemets*/ printf(" -\"-\"- "); /*idem ici avec les guillemets*/
return EXIT_SUCCESS; return EXIT_SUCCESS;
}
test
test
test$t
test}

BIN
BUT1/DEV2.1/TD/Exo1.class Normal file

Binary file not shown.

21
BUT1/DEV2.1/TD/Exo1.java Normal file
View File

@ -0,0 +1,21 @@
public class Exo1{
public static String plusCourt(String[] tab){
try{
String min;
int i = 0;
while(tab[i]==null){
i++;
}
min = tab[i];
for(i++;i<tab.length;i++){
if((tab[i] != null) && tab[i].length()< min.length()){
min = tab[i];
}
}
return min;
}catch(ArrayIndexOutOfBoundsException ex){
throw new IllegalArgumentException("aucune chaîne trouvée");
}
}
}

BIN
BUT1/DEV2.1/TD/Td.class Normal file

Binary file not shown.

View File

@ -1,26 +0,0 @@
public interface FileFilter{
boolean accept(File f);
}
public class DirectoryFilter implements FileFilter{
@Override
public boolean accept(File f){
return f.isDirectory();
}
}
public class Exemple{
public static void main(String[] args){
File home = new File(System.getProperty("user.home"));
File[] liste = home.listFiles(new DirectoryFilter());
for(File f : liste){
System.out.println(f);
}
}
}
public class Controleur extends MouseAdapter
implements MouseMotionListener, ActionListener{
...
}

BIN
BUT1/DEV2.1/TD/Test.class Normal file

Binary file not shown.

9
BUT1/DEV2.1/TD/Test.java Normal file
View File

@ -0,0 +1,9 @@
public class Test{
public static void main(String[] args){
try{
System.out.println(Exo1.plusCourt(args));
}catch(IllegalArgumentException e){
System.err.println("Pas d'arguments ?");
}
}
}

View File

@ -0,0 +1,11 @@
[0, inf, inf, inf, inf, 1, inf, 1, inf, 2, inf]
[inf, 0, 2, 1, 3, inf, 2, inf, 1, inf, 3]
[inf, 2, 0, 1, 1, inf, 2, inf, 3, inf, 1]
[inf, 1, 1, 0, 2, inf, 1, inf, 2, inf, 2]
[inf, 3, 1, 2, 0, inf, 3, inf, 4, inf, 1]
[1, inf, inf, inf, inf, 0, inf, 2, inf, 1, inf]
[inf, 2, 2, 1, 3, inf, 0, inf, 3, inf, 3]
[1, inf, inf, inf, inf, 2, inf, 0, inf, 3, inf]
[inf, 1, 3, 2, 4, inf, 3, inf, 0, inf, 4]
[2, inf, inf, inf, inf, 1, inf, 3, inf, 0, inf]
[inf, 3, 1, 2, 1, inf, 3, inf, 4, inf, 0]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -48,6 +48,5 @@ public class Fond implements ActionListener {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// Vous pouvez implémenter cette méthode si nécessaire
} }
} }