Exercice en java
delgado
-
daronmaster Messages postés 326 Date d'inscription Statut Membre Dernière intervention -
daronmaster Messages postés 326 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j ai un pti cours enjava et je galere, il y a un exercice ou par exemple on rentre le "mot" suivant aaaaccbbbddddddefffff et on doit obtenir abcdef
merci de m aider
j ai un pti cours enjava et je galere, il y a un exercice ou par exemple on rentre le "mot" suivant aaaaccbbbddddddefffff et on doit obtenir abcdef
merci de m aider
Configuration: Windows XP Internet Explorer 6.0
A voir également:
- Exercice en java
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Jeux java itel touche ✓ - Forum Logiciels
- Jeux java itel 5360 - Forum Mobile
2 réponses
Oula, sa fait très longtemps que j'ai pas fait de java..
Moi je ferais sa :
string chaine;
char car;
string rep;
car = 'a';
while(car <= z)
{
if (chaine.indexOf(car)!= null)
{
rep=rep+car;
}
car = car+1;
}
Bon je suis sur que ce n'est syntaxiquement pas bon mais sa doit te donner une piste pour ton exo..
Moi je ferais sa :
string chaine;
char car;
string rep;
car = 'a';
while(car <= z)
{
if (chaine.indexOf(car)!= null)
{
rep=rep+car;
}
car = car+1;
}
Bon je suis sur que ce n'est syntaxiquement pas bon mais sa doit te donner une piste pour ton exo..
moi j'aurais fait un truc du genre
char c;
string ta_string="aaaabbbbbccccddddeeefff";
string res=string(ta_string.charAt(0));
int i=0; // ou 1 je ne sais plus comment sont indexés les string ...
while(i<(ta_string.length()-1)){
if (=ta_string.charAt(i) != ta_string.charAt(i+1)){
res.concat(string(ta_string.charAt(i+1)));
}
i++;
}
essaie voir
tchû
char c;
string ta_string="aaaabbbbbccccddddeeefff";
string res=string(ta_string.charAt(0));
int i=0; // ou 1 je ne sais plus comment sont indexés les string ...
while(i<(ta_string.length()-1)){
if (=ta_string.charAt(i) != ta_string.charAt(i+1)){
res.concat(string(ta_string.charAt(i+1)));
}
i++;
}
essaie voir
tchû