Probleme java variable aleatoire
Résolu
guess025
Messages postés
3
Date d'inscription
Statut
Membre
Dernière intervention
-
guess025 Messages postés 3 Date d'inscription Statut Membre Dernière intervention -
guess025 Messages postés 3 Date d'inscription Statut Membre Dernière intervention -
Bonjour, voila mon code le problème est pour la variable aléatoire
public class personnage {
public static void main (String [ ] args) {
int Cpers, Lpers, Lobjectif, Cobjectif ;
int N=5 ;
do {
Ecran.afficherln ( " coordonnée L du personnage" ) ;
Lpers=Clavier.saisirInt () ;
Ecran.afficherln ( " coordonnée C du personnage " ) ;
Cpers=Clavier.saisirInt () ;
if (Lpers>5 || Cpers>5) {
Ecran.afficherln ( " erreur coordonnée impossible veuillez saisir a nouveau " ) ;
}
}while (Lpers>5 || Cpers>5) ;
Ecran.afficherln ( "coordonnée du personnage ( " ,Lpers , ", " , Cpers , " ) " ) ;
do {
Lobjectif= (int) ((math.random() *N) + 1 ) ;
Cobjectif= (int) ((math.random() *N) + 1 ) ;
}while ( Lobjectif==Lpers && Cobjectif==Cpers ) ;
ET VOICI L ERREUR AFFICHER
personnage.java:18: error: cannot find symbol
Lobjectif= (int) ((math.random() *N) + 1 ) ;
^
symbol: variable math
location: class personnage
personnage.java:19: error: cannot find symbol
Cobjectif= (int) ((math.random() *N) + 1 ) ;
^
symbol: variable math
location: class personnage
MERCI D AVANCE POUR VOTRE AIDE
public class personnage {
public static void main (String [ ] args) {
int Cpers, Lpers, Lobjectif, Cobjectif ;
int N=5 ;
do {
Ecran.afficherln ( " coordonnée L du personnage" ) ;
Lpers=Clavier.saisirInt () ;
Ecran.afficherln ( " coordonnée C du personnage " ) ;
Cpers=Clavier.saisirInt () ;
if (Lpers>5 || Cpers>5) {
Ecran.afficherln ( " erreur coordonnée impossible veuillez saisir a nouveau " ) ;
}
}while (Lpers>5 || Cpers>5) ;
Ecran.afficherln ( "coordonnée du personnage ( " ,Lpers , ", " , Cpers , " ) " ) ;
do {
Lobjectif= (int) ((math.random() *N) + 1 ) ;
Cobjectif= (int) ((math.random() *N) + 1 ) ;
}while ( Lobjectif==Lpers && Cobjectif==Cpers ) ;
ET VOICI L ERREUR AFFICHER
personnage.java:18: error: cannot find symbol
Lobjectif= (int) ((math.random() *N) + 1 ) ;
^
symbol: variable math
location: class personnage
personnage.java:19: error: cannot find symbol
Cobjectif= (int) ((math.random() *N) + 1 ) ;
^
symbol: variable math
location: class personnage
MERCI D AVANCE POUR VOTRE AIDE
A voir également:
- Probleme java variable aleatoire
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Waptrick java voiture - Télécharger - Jeux vidéo