Tableau 2 dimensions en java
NAS8
-
leadersolo -
leadersolo -
salut tt le monde !!!!
j ai vraiment besoin d aide ,je trouve pas la reponse de l exercice suivant
- Écrire une méthode qui reçoit un tableau à deux dimensions et
qui crée et retourne un tableau à une dimension constitué
des éléments maximals de chacune des lignes du tableau à 2D
je pense qu on a besoin de 2 boucle for
for(int i = 0; i < tab.length; i++){
for(int j = 0; j < tab[0].length;j++){
if (tab[i][j] > max)
max = tab[i][j];
et j ai aucune idée pour le reste ,SVP aider moi
pls pls pls
j ai vraiment besoin d aide ,je trouve pas la reponse de l exercice suivant
- Écrire une méthode qui reçoit un tableau à deux dimensions et
qui crée et retourne un tableau à une dimension constitué
des éléments maximals de chacune des lignes du tableau à 2D
je pense qu on a besoin de 2 boucle for
for(int i = 0; i < tab.length; i++){
for(int j = 0; j < tab[0].length;j++){
if (tab[i][j] > max)
max = tab[i][j];
et j ai aucune idée pour le reste ,SVP aider moi
pls pls pls
A voir également:
- Java tableau 2 dimensions dynamique
- Tableau croisé dynamique - Guide
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Tableau word - Guide
- Supercopier 2 - Télécharger - Gestion de fichiers
3 réponses
je te propose ça, mais je ne l'ai pas testé :
int [] TabMaxProc (int [] [] tab)
{
TabMax = new int [tab.length];
int max = tab [0][0];
for (int i=1; i<tab.length; i++)
{
for (int j=1; i<tab[0].length; j++) if (tab[i][j > max) max = tab[i][j];
max[i] = max;
}
return (TabMax);
}
dis moi si ça marche
bon courage
int [] TabMaxProc (int [] [] tab)
{
TabMax = new int [tab.length];
int max = tab [0][0];
for (int i=1; i<tab.length; i++)
{
for (int j=1; i<tab[0].length; j++) if (tab[i][j > max) max = tab[i][j];
max[i] = max;
}
return (TabMax);
}
dis moi si ça marche
bon courage
NAS8
merci pour ta proposition, mais ca ne marche pas vraiment!!!