Soustraction en java

Résolu
dzleito Messages postés 20 Date d'inscription dimanche 8 mai 2011 Statut Membre Dernière intervention 4 juin 2012 - 19 mai 2012 à 16:49
dzleito Messages postés 20 Date d'inscription dimanche 8 mai 2011 Statut Membre Dernière intervention 4 juin 2012 - 20 mai 2012 à 21:59
bonsoir
je veux fair l'operation de soustraction d'un entier sur un contenu entier dans un tableau
score=(score-(mm[i][2]))
j'ai pas pu fair sa marché :(
merçi

3 réponses

dzleito Messages postés 20 Date d'inscription dimanche 8 mai 2011 Statut Membre Dernière intervention 4 juin 2012
20 mai 2012 à 21:59
j'ai remplacer (mm[i][2]) par 2 ;
3
Utilisateur anonyme
20 mai 2012 à 01:06
Salut,

Peux-tu me donner la partie du code concerné car score=(score-(mm[i][2])) n'est pas suffisant pour que je puisse te poser des questions ou te faire modifier quelque chose.

Le programme est gros ? Et le tableau ?

Il faudrait aussi qu'on sache ce qui se passe, si c'est en "complilant" ou à l'exécution etc

...\ Dan /...
0
dzleito Messages postés 20 Date d'inscription dimanche 8 mai 2011 Statut Membre Dernière intervention 4 juin 2012
20 mai 2012 à 21:56
public class conduite extends javax.swing.JFrame {

int i=0;
conecteur_test t = new conecteur_test();
String [][]mm= new String[3][4];

int score=20;
int resultat;
/** Creates new form conduite */
public conduite() {
initComponents();
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {

jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jButton1.setText("gauche");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setText("Avancer");

jButton3.setText("droite");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jButton4.setText("Ralentir");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});

jButton5.setText("demarer");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(60, 60, 60)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(64, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(8, 8, 8)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3))
.addComponent(jButton4))
.addContainerGap(99, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 384, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 9, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3))
.addGap(29, 29, 29))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton5)
.addComponent(jButton4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addGap(23, 23, 23))
);

pack();
}//

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

try {

mm=t.conduite();
String rep="droite";
if (i
0
Rejoignez-nous