This commit is contained in:
Rémi Heredero 2021-11-20 10:59:16 +01:00
parent c2997d7363
commit 30faa26274
7 changed files with 40 additions and 25 deletions

3
.vscode/launch.json vendored
View File

@ -373,7 +373,8 @@
"name": "Launch random", "name": "Launch random",
"request": "launch", "request": "launch",
"mainClass": "various_tests.random", "mainClass": "various_tests.random",
"projectName": "Labo_6a2f7ad1" "projectName": "Labo_6a2f7ad1",
"encoding":"UTF-8"
} }
] ]
} }

19
.vscode/tasks.json vendored Normal file
View File

@ -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
}
}
]
}

Binary file not shown.

Binary file not shown.

View File

@ -7,7 +7,7 @@ public class WordManager {
void askSecretWord(){ void askSecretWord(){
//System.out.print("Enter your secret word: "); //System.out.print("Enter your secret word: ");
//String s = Input.readString(); //secretWord = Input.readString();
secretWord = Dialogs.getHiddenString("Enter your secret word: "); secretWord = Dialogs.getHiddenString("Enter your secret word: ");
secretWord = stripAccents(secretWord); secretWord = stripAccents(secretWord);
secretWord = secretWord.toLowerCase(); secretWord = secretWord.toLowerCase();

View File

@ -1,5 +1,9 @@
package various_tests; package various_tests;
import java.io.*; 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.<br> * The Class Input is here to enter data with the keyboard.<br>
@ -20,9 +24,15 @@ public class Input
*/ */
public static String readString() 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(); } try {return stdin.readLine(); }
catch (Exception ex) { return "";} catch (Exception ex) { return "";}
/* // VERSION PERSO
Scanner scanner = new Scanner(System.in);
return scanner.nextLine();
*/
} }
/** /**

View File

@ -1,32 +1,17 @@
package various_tests; package various_tests;
// import hevs.utils.Input; // import hevs.utils.Input;
public class random { 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<b?a:b;
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(alpha(Input.readChar(), Input.readChar()));; String s = "héllo";
System.out.println(s);
s = "";
while (true) {
s = Input.readString();
System.out.println(s);
}
} }
} }