martes, 10 de marzo de 2015

Operador xor binario en c++ - Disyunción exclusiva de dos númerosdecimales – Forex – Accident – Asesor – Service – Colleges – Money

C++ operadores logicos

En matemática discreta se manejan conceptos como la conjunción, disyunción,disyunción exclusiva y la negación. En esta entrada nos centraremos en la disyunción exclusiva y como podemos aplicarlaprogramando en c++ con eloperador XOR binario (a ^ b).

Inicialmente recordemos un poco sobre la tabla de verdad de este conectivo lógico.

ADisyuncion exclusivaB
1 0 1
1 1 0
0 1 1
0 0 0

Esto es: Cuando ambas proposiciones son verdaderas o ambas son falsas, entonces la disyunción exclusiva es falsa. Cuando una de ellas es verdaderas y la otra es falsa, entonces la disyunción exclusiva es verdadera. A nivel de bits,si un bit toma el valor de 1 y el otro 0 entonces el resultado del operador xor (a ^ b) es 1, de lo contrario será 0.

Desarrollemos un programa enc++ que lea dos números decimales a ^ b, aplicaremos el operador xor en dichos números y su resultado que será otro número decimal lo mostraremos por pantalla.

#include iostream

using namespace std;

int main(){
int a,b, c;
cin a b;
c = a ^ b;
cout c;
}

Entrada de prueba:
15
10

Salida:
5

¿Como se realiza la operación?El número15 en binario es1111 y el10 es1010. Su disyunción exclusiva se obtiene comparando bit con bit.

Te podría interesar:De sistema decimal a sistema binario en c++ y Java

1111
1010
------
0101

Donde 0101 es igual a:

0101
2^2+ 2^0 = 5


También te podría interesar:

  1. Encuentra desafíos de programación en HackerRank
  2. 22 guías y libros gratis para aprender a programar en c++
  3. Valor Absoluto de un número en c++
  4. Operaciones básicas para vectores de objetos en c++ (Acceso, Inserción, Tamaño y eliminación)
  5. Algoritmo - Factorial de un número en C++


Donate Your Car Sacramento Hire php developers injury lawyers west palm beach saskatchewan auto insurance donating used cars to charity DUI lawyer Social media management Hard drive Data Recovery Services Live casino Seo company houston motorcycle accident lawyer Social media platforms for business NEUSON Online casino accident attorney in los angeles Hire php developer selling my structured settlement ASBESTOS LAWYERS Christmas cards mesothelioma claim hughes net business structured settlement buyer business email web hosting mesothelioma attorneys california car accident lawyer san bernardino Criminal defense lawyer mesothelioma attorney assistance Mobile casino Custom WordPress theme designer DONATE YOUR CAR FOR MONEY Casino Insurance event management security ONLINE COLLEDGES Dallas Mesothelioma Attorneys Computer science classes online alcohol rehab center in florida truck accident attorney texas Make money online Australia Casino reviews Email Bulk Service Dwi lawyer selling structured settlement Seo companies Car Insurance in South Dakota Bankruptcy lawyer domain registration yahoo Business VOIP Solutions Injury Lawyers Car Insurance Quotes mesothelioma lawyer texas mesothelioma law suits Donate a Car in Maryland Donating a Car in Maryland New social media platforms Best social media platforms for business Online classes motor replacements DONATE YOUR CAR FOR KIDS Hire php programmers student loan consolidation program Donate car for tax credit Cheap domain registration hosting Criminal lawyer massage school dallas texas Service business software structured settlement quote motor insurance quotes city college in miami google affiliate mesothelioma law firm Criminal lawyer Miami HOLLAND MICHIGAN COLLEGE Car Insurance Quotes Colorado Online Classes Seo services Php programmers for hire Online Christmas cards att call conference personal injury attorney springfield mo business voice mail service better conferencing calls Photo Christmas cards sell structured settlement calculator Online College Course peritoneal mesothelioma Mortgage Adviser mesothelioma attorney california miami personal injury lawyer dallas mesothelioma attorneys Social media strategies Online Motor Insurance Quotes car insurance quotes pa Car Insurance Quotes MN Php programmers Best Seo company Auto Accident Attorney Italian cooking school holland michigan college WEBEX COSTS Donate Car to Charity California CHEAP CAR INSURANCE IN VIRGINIA Automobile Accident Attorney Business finance group Motor Replacements donate old cars to charity attorney lawyer mesothelioma illinois mesothelioma lawyer Criminal defense attorneys Florida WebEx costs Paperport Promotional Code accident attorney orange county Met Auto CAR INSURANCE QUOTES UTAH Structures Annuity Settlement car insurance quotes Adobe illustrator classes bus accident attorney los angeles Mesothelioma Law Firm Personal Injury Lawyer Social media examiner cash out structured settlement car insurance quotes colorado buying an annuity calculator Donate your Car for Money Donate Car for Tax Credit car accident lawyers Online motor insurance quotes motorcycle accident lawyer san francisco anti spam exchange server Business management software Online Criminal Justice Degree paperport promotional code PAPERPORT PROMOTIONAL CODE Car Insurance Quotes PA Best social media platforms Forex Trading Platform Custom Christmas cards VIRTUAL DATA ROOMS car donate pharmacist jobs in chicago WordPress themes for designers best criminal lawyer in arizona mesothelioma lawyer houston DALLAS MESOTHELIOMA ATTORNEYS utah mesothelioma lawyer WordPress hosting Psd to WordPress PHD on Counseling Education semi truck accident lawyers Donate Your Car for Kids mesothelioma information chicago hair laser removal mesothelioma lawyer dallas Cheap car insurance in Virginia Dayton Freight Lines Cheap auto insurance in VA accident attorney san bernardino Tech school Html email World Trade Center Footage Social media platforms Data Recovery Raid Proud Italian cook HOME PHONE INTERNET BUNDLE Psd to html workers compensation lawyer los angeles WordPress theme designers AUTO ACCIDENT ATTORNEY purchase structured settlements Donate old cars to charity Learning adobe illustrator DAYTON FREIGHT LINES Social media tools PhD in counseling education Social media campaigns Health Records Personal Health Record Paperport promotional code Donate Cars in MA WORLD TRADE CENTER FOOTAGE How to Donate A Car in California Donating Used Cars to Charity Auto Mobile Insurance Quote DONATE CARS IN MA home phone internet bundle Sell Annuity Payment structured settlemen offshore accident lawyer state of california car insurance Car insurance quotes Utah Dallas mesothelioma attorneys Asbestos Lawyers mesothelioma settlement amounts arizona auto accident attorney Futuristic architecture Annuity Settlements PHD IN COUNSELING EDUCATION Nunavut Culture STRUCTURED ANNUITY SETTLEMENT mesothelioma lawsuits mesothelioma symptoms asterisk call center software Car Donate car accident lawyer michigan mesothelioma lawsuit baltimore mesothelioma attorneys what is structured settlement Cheap Domain Registration Hosting Virtual Data Rooms Donate Cars Illinois Criminal Defense Attorneys Florida Best Criminal Lawyers in Arizona Car Insurance Quotes Utah Life Insurance Co Lincoln Holland Michigan College Donate Old Cars to Charity Dedicated Hosting Dedicated Server Hosting Online Colleges HOW TO DONATE A CAR IN CALIFORNIA car insurance quotes mn Massage School Dallas Texas Home Phone Internet Bundle Psychic for Free FORENSICS ONLINE COURSE Low Credit Line Credit Cards structured settlement sell Donate your car for kids Cheap Auto Insurance in VA Forensics Online Course ANNUITY SETTLEMENT ashely madis Neuson Royalty Free Images Stock boca raton personal injury attorney michigan motorcycle accident lawyer business administration masters DONATE OLD CARS TO CHARITY structured settlement brokers Webex Costs Cheap Car Insurance for Ladies Cheap Car Insurance in Virginia Register Free Domains mesothelioma attorney florida Better Conference Calls Futuristic Architecture how to donate a car in california Forensics online course DONATE CARS ILLINOIS donate your car for money uk homeowner loans

No hay comentarios:

Publicar un comentario