IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++Builder Discussion :

Opérateurs logiques en C


Sujet :

C++Builder

  1. #1
    Membre émérite
    Avatar de bandit boy
    Profil pro
    Inscrit en
    Février 2006
    Messages
    916
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 916
    Par défaut Opérateurs logiques en C
    Bonjour,
    Il existe plusieurs opérateur logique : ++, --, += ...

    Mais quelqun pourrait-il me confirmer ce que signifie ^=
    Est ce un complément ?

  2. #2
    Membre confirmé
    Profil pro
    Étudiant
    Inscrit en
    Juin 2006
    Messages
    92
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juin 2006
    Messages : 92
    Par défaut
    Salut,

    il me semble que l'opérateur ^= est le OU EXCLUSIF (XOR)...
    Regardes dans l'aide, ça y est aussi...

  3. #3
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Par défaut
    L'aide est un peu juste.
    Syntax

    unary-expr assignment-op assignment-expr

    Remarks

    The assignment operators are:

    = *= /= %= += -=

    <<= >>= &= ^= |=

    The = operator is the only simple assignment operator, the others are compound assignment operators.

    In the expression E1 = E2, E1 must be a modifiable lvalue. The assignment expression itself is not an lvalue.

    The expression

    E1 op= E2

    has the same effect as

    E1 = E1 op E2

    except the lvalue E1 is evaluated only once. For example, E1 += E2 is the same as E1 = E1 + E2.

    The expression's value is E1 after the expression evaluates.

    For both simple and compound assignment, the operands E1 and E2 must obey one of the following rules:

    1. E1 is a qualified or unqualified arithmetic type and E2 is an arithmetic type.
    2. E1 has a qualified or unqualified version of a structure or union type compatible with the type of E2.
    3. E1 and E2 are pointers to qualified or unqualified versions of compatible types, and the type pointed to by the left has all the qualifiers of the type pointed to by the right.
    4. Either E1 or E2 is a pointer to an object or incomplete type and the other is a pointer to a qualified or unqualified version of void. The type pointed to by the left has all the qualifiers of the type pointed to by the right.

    5. E1 is a pointer and E2 is a null pointer constant.

    Note: Spaces separating compound operators (+<space>=) will generate errors.

    Note: There are certain conditions where assignment operators are not supported when used with properties.

  4. #4
    Membre émérite
    Avatar de bandit boy
    Profil pro
    Inscrit en
    Février 2006
    Messages
    916
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 916
    Par défaut
    J'ai vu ca, il donne tous les opérateurs, mais pas la signification.

  5. #5
    Membre confirmé
    Profil pro
    Étudiant
    Inscrit en
    Juin 2006
    Messages
    92
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juin 2006
    Messages : 92
    Par défaut
    Si tu as 2 nombres en hexa par exemple h1 et h2,
    faire h1 ^= h2 revient à dire :

    h1 = h1 XOR h2

    XOR est la fonction OU EXCLUSIF dont je te donne la table de vérité :

    h1 h2 (h1 XOR h2)
    0 0 0
    0 1 1
    1 0 1
    1 1 0

    Voilà, ça devrait t'aider...

  6. #6
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Par défaut
    J'ai trouve.
    Returns this Variant after performing a bitwise xor operation.

    Variant& __fastcall operator ^=(const Variant& rhs);

    Description

    The actual types of the Variants determine the meaning of this operation. If the Variants can be converted to types that make sense for the given operation, the assignment is performed. If any of these operations is not possible because of an invalid variant type conversion, an EVariantError exception is thrown.
    pour la recherche il faut ecrire operator ^=

  7. #7
    Membre émérite
    Avatar de bandit boy
    Profil pro
    Inscrit en
    Février 2006
    Messages
    916
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 916
    Par défaut
    Impec, Merci bien les gars

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Opérateur logique And entre 2 conditions
    Par User dans le forum Langage
    Réponses: 1
    Dernier message: 16/09/2006, 12h08
  2. Réponses: 4
    Dernier message: 04/08/2006, 15h47
  3. [EL] El et opérateur logique
    Par LeXo dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 20/07/2006, 21h28
  4. Opérateurs logiques: solution plus simple?
    Par p0Kep0K dans le forum Langage SQL
    Réponses: 4
    Dernier message: 27/04/2006, 15h48
  5. [VBA] Condition - opérateurs logiques
    Par Virgile59 dans le forum Access
    Réponses: 6
    Dernier message: 07/10/2005, 10h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo