diff --git a/.vscode/launch.json b/.vscode/launch.json index 560a0cf..4b4c274 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -373,7 +373,8 @@ "name": "Launch random", "request": "launch", "mainClass": "various_tests.random", - "projectName": "Labo_6a2f7ad1" + "projectName": "Labo_6a2f7ad1", + "encoding":"UTF-8" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..51a86b2 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "java", + "targetPath": "${workspaceFolder}/${workspaceFolderBasename}.jar", + "elements": [ + "${compileOutput}", + "${dependencies}" + ], + "problemMatcher": [], + "label": "java: exportjar:Labo", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/bin/various_tests/Input.class b/bin/various_tests/Input.class index a3aa29e..9885a96 100644 Binary files a/bin/various_tests/Input.class and b/bin/various_tests/Input.class differ diff --git a/bin/various_tests/random.class b/bin/various_tests/random.class index 1f6580c..14d0de5 100644 Binary files a/bin/various_tests/random.class and b/bin/various_tests/random.class differ diff --git a/src/lab6/WordManager.java b/src/lab6/WordManager.java index 1fb546a..5345451 100644 --- a/src/lab6/WordManager.java +++ b/src/lab6/WordManager.java @@ -7,7 +7,7 @@ public class WordManager { void askSecretWord(){ //System.out.print("Enter your secret word: "); - //String s = Input.readString(); + //secretWord = Input.readString(); secretWord = Dialogs.getHiddenString("Enter your secret word: "); secretWord = stripAccents(secretWord); secretWord = secretWord.toLowerCase(); diff --git a/src/various_tests/Input.java b/src/various_tests/Input.java index e98b08c..e6ff6ce 100644 --- a/src/various_tests/Input.java +++ b/src/various_tests/Input.java @@ -1,5 +1,9 @@ package various_tests; import java.io.*; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.charset.spi.CharsetProvider; +import java.util.Scanner; /** * The Class Input is here to enter data with the keyboard.
@@ -20,9 +24,15 @@ public class Input */ public static String readString() { - BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); + // VERSION PROF + BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_16)); try {return stdin.readLine(); } catch (Exception ex) { return "";} + + /* // VERSION PERSO + Scanner scanner = new Scanner(System.in); + return scanner.nextLine(); + */ } /** diff --git a/src/various_tests/random.java b/src/various_tests/random.java index 03bcd26..a51e8ae 100644 --- a/src/various_tests/random.java +++ b/src/various_tests/random.java @@ -1,32 +1,17 @@ package various_tests; - // import hevs.utils.Input; public class random { - - - public static int nbr(boolean a, boolean b, boolean c) { - int nbr = 0; - if (a) { - nbr+=1; - } - if (b) { - nbr+=1; - } - if (c) { - nbr+=1; - } - return nbr; - } - - public static char alpha(char a, char b) { - return a